change pixel-trace directory permission

Recently, I saw some of bugreports doesn't include mm_event dump.
dumpstate_board.txt says just permission error instead of dumping trace.
I could reproduce it with android restarting( shell$ stop; start).

The permission in pixel-trace directory is changed from

        drwxr-xr-x 5 root root 0 2019-02-15 21:21 pixel-trace

to

        drw------- 5 root root 0 2019-02-15 21:21 pixel-trace

Originally, 600 permission is buggy from the beginning because directory
needs execution permission bit to allow access the file. However, question
is why the permission is not set when the directory is created but does
android is restarted.
The tracefs in kernel seems to not support permission when the directory
is created. It just use 755 hardcoding if I parse it rightly.

https://elixir.bootlin.com/linux/v5.0-rc6/source/fs/tracefs/inode.c#L430

I also read mkdir script implementation(i.e., do_mkdir). It does fchmod
if it founds the file is already existing. That's why the restart changes
the permission to the one I wrote in the script.

Let fix it to set the permission to 755 for directory and 660 files
from the beginning so that it should work even though android restart
accidentally.

Test: confirmed it works device $ stop; start; host$ adb bugreport
Bug: 124497081
Bug: 152367346
Change-Id: I0a76292627c96dfae02ff82f6ed7ca1519922e19
Signed-off-by: Minchan Kim <minchan@google.com>
diff --git a/init.hardware.rc b/init.hardware.rc
index 3eb0858..1e5d212 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -544,8 +544,11 @@
     # Create pixel-trace.
     # At this moment, only mm_event is available. If others want to put more,
     # it should get hard review from pixel-perf-team.
-
-    mkdir /sys/kernel/debug/tracing/instances/pixel-trace 600
+    mkdir /sys/kernel/debug/tracing/instances/pixel-trace 0755 system system
+    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/trace
+    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/trace
+    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
+    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
     write /sys/kernel/debug/tracing/instances/pixel-trace/buffer_size_kb 64
     write /sys/kernel/debug/tracing/instances/pixel-trace/events/mm_event/enable 1