244bc7cf97
Historically most uses of atrace happen via the shell domain.
There are two exceptions:
- boot tracing
- traced_probes
We need to get feature parity, so atrace has the same behavior
when is invoked either via shell or from its own domain (e.g.
via traced_probes that has an auto_trans rule into atrace on exec).
Atrace works by setting system properties to enable tracing from userspace
then poking all the binder services to read the system properties (see [1]) so
enabling the system_server category requires the ability to call binder
methods on the system_server.
For more use cases see b/113127224
[1]: 9ead54bed6/cmds/atrace/atrace.cpp (545)
Bug: 113127224
Test: Add an atrace category to the Perfetto config and confirm the data
shows up.
Change-Id: Id077eff960ffb1cdd7b0ce84b21ac9ef70444a4a
48 lines
1.5 KiB
Text
48 lines
1.5 KiB
Text
# Domain for atrace process.
|
|
# It is spawned either by traced_probes or by init for the boottrace service.
|
|
|
|
type atrace, domain, coredomain;
|
|
type atrace_exec, exec_type, file_type;
|
|
|
|
# boottrace services uses /data/misc/boottrace/categories
|
|
allow atrace boottrace_data_file:dir search;
|
|
allow atrace boottrace_data_file:file r_file_perms;
|
|
|
|
# Allow atrace to access tracefs.
|
|
allow atrace debugfs_tracing:dir r_dir_perms;
|
|
allow atrace debugfs_tracing:file rw_file_perms;
|
|
allow atrace debugfs_trace_marker:file getattr;
|
|
|
|
# atrace sets debug.atrace.* properties
|
|
set_prop(atrace, debug_prop)
|
|
|
|
# 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)
|
|
allow atrace healthd:binder call;
|
|
allow atrace surfaceflinger:binder call;
|
|
allow atrace system_server: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;
|
|
')
|