Skip to content
Snippets Groups Projects
Commit ad60c564 authored by Primiano Tucci's avatar Primiano Tucci Committed by Android (Google) Code Review
Browse files

Merge "Reland: perfetto: allow traced_probes to execute atrace" into pi-dev

parents 16d28d0f f3fd4d6b
No related branches found
No related tags found
No related merge requests found
# Domain for atrace process spawned by boottrace service. # Domain for atrace process.
# It is spawned either by traced_probes or by init for the boottrace service.
type atrace_exec, exec_type, file_type;
userdebug_or_eng(`
type atrace, domain, coredomain; type atrace, domain, coredomain;
type atrace_exec, exec_type, file_type;
init_daemon_domain(atrace)
# boottrace services uses /data/misc/boottrace/categories # boottrace services uses /data/misc/boottrace/categories
allow atrace boottrace_data_file:dir search; allow atrace boottrace_data_file:dir search;
...@@ -14,15 +11,36 @@ userdebug_or_eng(` ...@@ -14,15 +11,36 @@ userdebug_or_eng(`
# Allow atrace to access tracefs. # Allow atrace to access tracefs.
allow atrace debugfs_tracing:dir r_dir_perms; allow atrace debugfs_tracing:dir r_dir_perms;
allow atrace debugfs_tracing:file rw_file_perms; allow atrace debugfs_tracing:file rw_file_perms;
allow atrace debugfs_tracing_debug:dir r_dir_perms;
allow atrace debugfs_tracing_debug:file rw_file_perms;
allow atrace debugfs_trace_marker:file getattr; allow atrace debugfs_trace_marker:file getattr;
# atrace sets debug.atrace.* properties # atrace sets debug.atrace.* properties
set_prop(atrace, debug_prop) set_prop(atrace, debug_prop)
# atrace pokes all the binder-enabled processes at startup. # atrace pokes all the binder-enabled processes at startup with a
# SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties.
binder_use(atrace) binder_use(atrace)
allow atrace healthd:binder call; allow atrace healthd:binder call;
allow atrace surfaceflinger:binder call; allow atrace surfaceflinger:binder call;
get_prop(atrace, hwservicemanager_prop)
allow atrace {
service_manager_type
-incident_service
-netd_service
-stats_service
-dumpstate_service
-installd_service
-vold_service
}:service_manager { find };
allow atrace servicemanager:service_manager list;
userdebug_or_eng(`
# atrace is generally invoked as a standalone binary from shell or perf
# daemons like Perfetto traced_probes. However, in userdebug builds, there is
# a further option to run atrace as an init daemon for boot tracing.
init_daemon_domain(atrace)
allow atrace debugfs_tracing_debug:dir r_dir_perms;
allow atrace debugfs_tracing_debug:file rw_file_perms;
') ')
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
(typeattribute new_objects) (typeattribute new_objects)
(typeattributeset new_objects (typeattributeset new_objects
( adbd_exec ( adbd_exec
atrace
binder_calls_stats_service binder_calls_stats_service
bootloader_boot_reason_prop bootloader_boot_reason_prop
blank_screen blank_screen
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
;; previous ones. Add here to pass checkapi tests. ;; previous ones. Add here to pass checkapi tests.
(typeattribute new_objects) (typeattribute new_objects)
(typeattributeset new_objects (typeattributeset new_objects
( binder_calls_stats_service ( atrace
binder_calls_stats_service
blank_screen blank_screen
blank_screen_exec blank_screen_exec
blank_screen_tmpfs blank_screen_tmpfs
......
...@@ -61,7 +61,7 @@ full_treble_only(` ...@@ -61,7 +61,7 @@ full_treble_only(`
# tracefs # tracefs
neverallow { neverallow {
coredomain coredomain
userdebug_or_eng(`-atrace') -atrace
-dumpstate -dumpstate
-init -init
userdebug_or_eng(`-perfprofd') userdebug_or_eng(`-perfprofd')
......
...@@ -35,6 +35,14 @@ allow traced_probes kmsg_device:chr_file write; ...@@ -35,6 +35,14 @@ allow traced_probes kmsg_device:chr_file write;
# Allow traced_probes to list the system partition. # Allow traced_probes to list the system partition.
allow traced_probes system_file:dir { open read }; allow traced_probes system_file:dir { open read };
# Allow traced_probes to run atrace. atrace pokes at system services to enable
# their userspace TRACE macros.
domain_auto_trans(traced_probes, atrace_exec, atrace);
# This is needed for: path="/system/bin/linker64"
# scontext=u:r:atrace:s0 tcontext=u:r:traced_probes:s0 tclass=fd
allow atrace traced_probes:fd use;
### ###
### Neverallow rules ### Neverallow rules
### ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment