platform_system_core/rootdir/init.trace.rc
Fred Fettinger 331a939bf8 init.trace.rc: fix race condition with class_start core
The systrace permissions from init.trace.rc and the "class_start core"
which launches surfaceflinger are both in an "on boot" section. However,
the init.trace.rc commands are parsed after all commands in init.rc.
This means that "class_start core" is executed before the chmod command
which allows processes to write to trace_marker. If any services
execute their first trace command before the chmod occurs, then that
service won't be able to write traces until the service is restarted.

To fix this, run all of the init.trace.rc commands in the "early-boot"
section to ensure they are completed first.

Bug: 17612265
Change-Id: Ibf544762173d5ba98272c66ef485d8eab7d70bf3
2014-10-01 12:29:29 -07:00

35 lines
1.9 KiB
Text

## Permissions to allow system-wide tracing to the kernel trace buffer.
##
on early-boot
# Allow writing to the kernel trace log.
chmod 0222 /sys/kernel/debug/tracing/trace_marker
# Allow the shell group to enable (some) kernel tracing.
chown root shell /sys/kernel/debug/tracing/trace_clock
chown root shell /sys/kernel/debug/tracing/buffer_size_kb
chown root shell /sys/kernel/debug/tracing/options/overwrite
chown root shell /sys/kernel/debug/tracing/options/print-tgid
chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
chown root shell /sys/kernel/debug/tracing/events/power/cpu_idle/enable
chown root shell /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
chown root shell /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
chown root shell /sys/kernel/debug/tracing/tracing_on
chmod 0664 /sys/kernel/debug/tracing/trace_clock
chmod 0664 /sys/kernel/debug/tracing/buffer_size_kb
chmod 0664 /sys/kernel/debug/tracing/options/overwrite
chmod 0664 /sys/kernel/debug/tracing/options/print-tgid
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_idle/enable
chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
chmod 0664 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
chmod 0664 /sys/kernel/debug/tracing/tracing_on
# Allow only the shell group to read and truncate the kernel trace.
chown root shell /sys/kernel/debug/tracing/trace
chmod 0660 /sys/kernel/debug/tracing/trace