diff --git a/app.te b/app.te index c8009dc52fbb4eb5b714e90d2c764d3157a94556..9a00b11b76f461b87ca25f3e92598172c79a0c0e 100644 --- a/app.te +++ b/app.te @@ -25,9 +25,13 @@ allow appdomain zygote_tmpfs:file read; # Notify zygote of death; allow appdomain zygote:process sigchld; -# Notify zygote of the wrapped process PID when using --invoke-with. userdebug_or_eng(` + # Notify zygote of the wrapped process PID when using --invoke-with. allow appdomain zygote:fifo_file write; + + # Allow apps to create and write method traces in /data/misc/trace. + allow appdomain method_trace_data_file:dir w_dir_perms; + allow appdomain method_trace_data_file:file { create w_file_perms }; ') # Notify shell and adbd of death when spawned via runas for ndk-gdb. diff --git a/file.te b/file.te index 383c3c5a947a6469475bd5aae4f592dd67763b09..d7b73ed12a2b43431f12d65d54c2edf492bc16f7 100644 --- a/file.te +++ b/file.te @@ -126,6 +126,8 @@ type wifi_data_file, file_type, data_file_type; type zoneinfo_data_file, file_type, data_file_type; type vold_data_file, file_type, data_file_type; type perfprofd_data_file, file_type, data_file_type, mlstrustedobject; +# /data/misc/trace for method traces on userdebug / eng builds +type method_trace_data_file, file_type, data_file_type, mlstrustedobject; # Compatibility with type names used in vanilla Android 4.3 and 4.4. typealias audio_data_file alias audio_firmware_file; diff --git a/file_contexts b/file_contexts index d69c5e5744d2656b8841dc4284d00d134abddbc9..bce2e8b2931200ab4531ba22cebeabe2a23c66b2 100644 --- a/file_contexts +++ b/file_contexts @@ -279,6 +279,7 @@ /data/misc/perfprofd(/.*)? u:object_r:perfprofd_data_file:s0 /data/misc/update_engine(/.*)? u:object_r:update_engine_data_file:s0 /data/system/heapdump(/.*)? u:object_r:heapdump_data_file:s0 +/data/misc/trace(/.*)? u:object_r:method_trace_data_file:s0 # Fingerprint data /data/system/users/[0-9]+/fpdata(/.*)? u:object_r:fingerprintd_data_file:s0 diff --git a/system_server.te b/system_server.te index db8a6dae0639516e5bbd87444e5c3ee43ec3ee69..21da6514327a76cc71bbd383c6e5383d12befee1 100644 --- a/system_server.te +++ b/system_server.te @@ -428,6 +428,12 @@ allow system_server fingerprintd_data_file:dir {r_dir_perms relabelto}; # Allow system process to read network MAC address allow system_server sysfs_mac_address:file r_file_perms; +userdebug_or_eng(` + # Allow system server to create and write method traces in /data/misc/trace. + allow system_server method_trace_data_file:dir w_dir_perms; + allow system_server method_trace_data_file:file { create w_file_perms }; +') + ### ### Neverallow rules ### diff --git a/zygote.te b/zygote.te index d7a8a997a578b905753fd1e2be127cb83eeb8d89..882ed802b4bc377a54fd9f03a5b3d29b8cfd7fa3 100644 --- a/zygote.te +++ b/zygote.te @@ -68,6 +68,12 @@ allow zygote storage_file:dir { search mounton }; # Handle --invoke-with command when launching Zygote with a wrapper command. allow zygote zygote_exec:file rx_file_perms; +userdebug_or_eng(` + # Allow zygote to create and write method traces in /data/misc/trace. + allow zygote method_trace_data_file:dir w_dir_perms; + allow zygote method_trace_data_file:file { create w_file_perms }; +') + ### ### neverallow rules ###