blob: cbb5b7c5bfdf6a94a25518f1764552dd2a38f8b8 [file] [log] [blame]
Primiano Tuccifeaf22b2018-03-02 19:27:06 +00001# Domain for atrace process.
2# It is spawned either by traced_probes or by init for the boottrace service.
Alex Klyubin357c1612017-02-07 10:54:20 -08003
Nick Kralevich5e372712018-09-27 10:21:37 -07004type atrace_exec, exec_type, file_type, system_file_type;
Alex Klyubin357c1612017-02-07 10:54:20 -08005
Primiano Tuccifeaf22b2018-03-02 19:27:06 +00006# boottrace services uses /data/misc/boottrace/categories
7allow atrace boottrace_data_file:dir search;
8allow atrace boottrace_data_file:file r_file_perms;
Alex Klyubin357c1612017-02-07 10:54:20 -08009
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000010# Allow atrace to access tracefs.
11allow atrace debugfs_tracing:dir r_dir_perms;
12allow atrace debugfs_tracing:file rw_file_perms;
13allow atrace debugfs_trace_marker:file getattr;
14
Lalit Magantid6ae1a52018-11-16 12:17:24 +000015# Allow atrace to write data when a pipe is used for stdout/stderr
16# This is used by Perfetto to capture the output on error in atrace.
17allow atrace traced_probes:fd use;
18allow atrace traced_probes:fifo_file write;
19
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000020# atrace sets debug.atrace.* properties
21set_prop(atrace, debug_prop)
22
23# atrace pokes all the binder-enabled processes at startup with a
24# SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties.
25
Ryan Savitski19459a32019-05-15 16:45:04 +010026# Allow discovery of binder services.
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000027allow atrace {
28 service_manager_type
Martijn Coenenac097ac2018-08-17 09:35:42 +020029 -apex_service
Luke Huang524f25e2019-02-25 20:12:15 +080030 -dnsresolver_service
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000031 -dumpstate_service
Carmen Jacksona60d7f22021-06-23 16:53:45 -070032 -incident_service
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000033 -installd_service
Carmen Jacksona60d7f22021-06-23 16:53:45 -070034 -iorapd_service
Yifan Hong18ade862019-03-14 15:45:03 -070035 -lpdump_service
Carmen Jacksona60d7f22021-06-23 16:53:45 -070036 -netd_service
37 -stats_service
38 -tracingproxy_service
39 -vold_service
Steven Morelanda30464c2020-01-21 10:18:57 -080040 -default_android_service
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000041}:service_manager { find };
42allow atrace servicemanager:service_manager list;
43
Ryan Savitski19459a32019-05-15 16:45:04 +010044# Allow notifying the processes hosting specific binder services that
45# trace-related system properties have changed.
46binder_use(atrace)
Ryan Savitski19459a32019-05-15 16:45:04 +010047allow atrace surfaceflinger:binder call;
48allow atrace system_server:binder call;
49allow atrace cameraserver:binder call;
50
51# Similarly, on debug builds, allow specific HALs to be notified that
52# trace-related system properties have changed.
53userdebug_or_eng(`
54 # List HAL interfaces.
55 allow atrace hwservicemanager:hwservice_manager list;
56 # Notify the camera HAL.
57 hal_client_domain(atrace, hal_camera)
Harpreet "Eli" Sangha1b62e7f2019-06-17 12:25:05 +090058 hal_client_domain(atrace, hal_vibrator)
Ryan Savitski19459a32019-05-15 16:45:04 +010059')
60
Jeff Sharkeya0e7a6d2020-07-31 12:28:11 -060061# Remove logspam from notification attempts to non-allowlisted services.
Ryan Savitski19459a32019-05-15 16:45:04 +010062dontaudit atrace hwservice_manager_type:hwservice_manager find;
63dontaudit atrace service_manager_type:service_manager find;
64dontaudit atrace domain:binder call;
65
66# atrace can call atrace HAL
67hal_client_domain(atrace, hal_atrace)
68
69get_prop(atrace, hwservicemanager_prop)
70
Primiano Tuccifeaf22b2018-03-02 19:27:06 +000071userdebug_or_eng(`
72 # atrace is generally invoked as a standalone binary from shell or perf
73 # daemons like Perfetto traced_probes. However, in userdebug builds, there is
74 # a further option to run atrace as an init daemon for boot tracing.
Yasuhiro Matsuda3d328172015-06-24 15:24:17 +090075 init_daemon_domain(atrace)
Alex Klyubin357c1612017-02-07 10:54:20 -080076
Carmen Jackson2c8ca452018-01-30 18:14:45 -080077 allow atrace debugfs_tracing_debug:dir r_dir_perms;
Dan Cashman91d398d2017-09-26 12:58:29 -070078 allow atrace debugfs_tracing_debug:file rw_file_perms;
Nick Kralevichb56e6ef2016-12-09 20:14:31 -080079')