Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 1 | # Domain for atrace process. |
| 2 | # It is spawned either by traced_probes or by init for the boottrace service. |
Alex Klyubin | 357c161 | 2017-02-07 10:54:20 -0800 | [diff] [blame] | 3 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 4 | type atrace, domain, coredomain; |
Nick Kralevich | 5e37271 | 2018-09-27 10:21:37 -0700 | [diff] [blame] | 5 | type atrace_exec, exec_type, file_type, system_file_type; |
Alex Klyubin | 357c161 | 2017-02-07 10:54:20 -0800 | [diff] [blame] | 6 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 7 | # boottrace services uses /data/misc/boottrace/categories |
| 8 | allow atrace boottrace_data_file:dir search; |
| 9 | allow atrace boottrace_data_file:file r_file_perms; |
Alex Klyubin | 357c161 | 2017-02-07 10:54:20 -0800 | [diff] [blame] | 10 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 11 | # Allow atrace to access tracefs. |
| 12 | allow atrace debugfs_tracing:dir r_dir_perms; |
| 13 | allow atrace debugfs_tracing:file rw_file_perms; |
| 14 | allow atrace debugfs_trace_marker:file getattr; |
| 15 | |
Lalit Maganti | d6ae1a5 | 2018-11-16 12:17:24 +0000 | [diff] [blame] | 16 | # Allow atrace to write data when a pipe is used for stdout/stderr |
| 17 | # This is used by Perfetto to capture the output on error in atrace. |
| 18 | allow atrace traced_probes:fd use; |
| 19 | allow atrace traced_probes:fifo_file write; |
| 20 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 21 | # atrace sets debug.atrace.* properties |
| 22 | set_prop(atrace, debug_prop) |
| 23 | |
| 24 | # atrace pokes all the binder-enabled processes at startup with a |
| 25 | # SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties. |
| 26 | |
| 27 | binder_use(atrace) |
| 28 | allow atrace healthd:binder call; |
| 29 | allow atrace surfaceflinger:binder call; |
Hector Dearman | 244bc7c | 2018-09-05 15:21:54 +0100 | [diff] [blame] | 30 | allow atrace system_server:binder call; |
| 31 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 32 | get_prop(atrace, hwservicemanager_prop) |
| 33 | |
Wei Wang | bc71a61 | 2018-09-19 16:06:28 -0700 | [diff] [blame] | 34 | # atrace can call atrace HAL |
| 35 | hal_client_domain(atrace, hal_atrace) |
| 36 | |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 37 | allow atrace { |
| 38 | service_manager_type |
Martijn Coenen | ac097ac | 2018-08-17 09:35:42 +0200 | [diff] [blame] | 39 | -apex_service |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 40 | -incident_service |
Igor Murashkin | 72a88b1 | 2018-10-05 14:48:29 -0700 | [diff] [blame] | 41 | -iorapd_service |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 42 | -netd_service |
Luke Huang | 524f25e | 2019-02-25 20:12:15 +0800 | [diff] [blame^] | 43 | -dnsresolver_service |
Primiano Tucci | feaf22b | 2018-03-02 19:27:06 +0000 | [diff] [blame] | 44 | -stats_service |
| 45 | -dumpstate_service |
| 46 | -installd_service |
| 47 | -vold_service |
| 48 | }:service_manager { find }; |
| 49 | allow atrace servicemanager:service_manager list; |
| 50 | |
| 51 | userdebug_or_eng(` |
| 52 | # atrace is generally invoked as a standalone binary from shell or perf |
| 53 | # daemons like Perfetto traced_probes. However, in userdebug builds, there is |
| 54 | # a further option to run atrace as an init daemon for boot tracing. |
Yasuhiro Matsuda | 3d32817 | 2015-06-24 15:24:17 +0900 | [diff] [blame] | 55 | init_daemon_domain(atrace) |
Alex Klyubin | 357c161 | 2017-02-07 10:54:20 -0800 | [diff] [blame] | 56 | |
Carmen Jackson | 2c8ca45 | 2018-01-30 18:14:45 -0800 | [diff] [blame] | 57 | allow atrace debugfs_tracing_debug:dir r_dir_perms; |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 58 | allow atrace debugfs_tracing_debug:file rw_file_perms; |
Nick Kralevich | b56e6ef | 2016-12-09 20:14:31 -0800 | [diff] [blame] | 59 | ') |