1# Domain for atrace process.
2# It is spawned either by traced_probes or by init for the boottrace service.
3
4type atrace, domain, coredomain;
5type atrace_exec, exec_type, file_type;
6
7# boottrace services uses /data/misc/boottrace/categories
8allow atrace boottrace_data_file:dir search;
9allow atrace boottrace_data_file:file r_file_perms;
10
11# Allow atrace to access tracefs.
12allow atrace debugfs_tracing:dir r_dir_perms;
13allow atrace debugfs_tracing:file rw_file_perms;
14allow atrace debugfs_trace_marker:file getattr;
15
16# atrace sets debug.atrace.* properties
17set_prop(atrace, debug_prop)
18
19# atrace pokes all the binder-enabled processes at startup with a
20# SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties.
21
22binder_use(atrace)
23allow atrace healthd:binder call;
24allow atrace surfaceflinger:binder call;
25get_prop(atrace, hwservicemanager_prop)
26
27allow atrace {
28  service_manager_type
29  -incident_service
30  -netd_service
31  -stats_service
32  -dumpstate_service
33  -installd_service
34  -vold_service
35}:service_manager { find };
36allow atrace servicemanager:service_manager list;
37
38userdebug_or_eng(`
39  # atrace is generally invoked as a standalone binary from shell or perf
40  # daemons like Perfetto traced_probes. However, in userdebug builds, there is
41  # a further option to run atrace as an init daemon for boot tracing.
42  init_daemon_domain(atrace)
43
44  allow atrace debugfs_tracing_debug:dir r_dir_perms;
45  allow atrace debugfs_tracing_debug:file rw_file_perms;
46')
47