Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute dumpstate coredomain; |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 2 | type dumpstate_tmpfs, file_type; |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 3 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 4 | init_daemon_domain(dumpstate) |
| 5 | |
| 6 | # Execute and transition to the vdc domain |
| 7 | domain_auto_trans(dumpstate, vdc_exec, vdc) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 8 | |
Joel Scherpelz | 5e901bb | 2017-04-25 11:53:51 +0900 | [diff] [blame] | 9 | # Acquire advisory lock on /system/etc/xtables.lock from ip[6]tables |
| 10 | allow dumpstate system_file:file lock; |
| 11 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 12 | allow dumpstate storaged_exec:file rx_file_perms; |
| 13 | |
Hongming Jin | 58f8341 | 2021-02-09 12:03:40 -0800 | [diff] [blame^] | 14 | # /data/misc/a11ytrace for accessibility traces |
| 15 | userdebug_or_eng(` |
| 16 | allow dumpstate accessibility_trace_data_file:dir r_dir_perms; |
| 17 | allow dumpstate accessibility_trace_data_file:file r_file_perms; |
| 18 | ') |
| 19 | |
Vishnu Nair | 2d6942d | 2017-11-17 08:23:32 -0800 | [diff] [blame] | 20 | # /data/misc/wmtrace for wm traces |
| 21 | userdebug_or_eng(` |
| 22 | allow dumpstate wm_trace_data_file:dir r_dir_perms; |
| 23 | allow dumpstate wm_trace_data_file:file r_file_perms; |
| 24 | ') |
| 25 | |
Mike Ma | de3a3e4 | 2018-12-03 10:35:40 -0800 | [diff] [blame] | 26 | # Allow dumpstate to make binder calls to incidentd |
| 27 | binder_call(dumpstate, incidentd) |
| 28 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 29 | # Allow dumpstate to make binder calls to storaged service |
| 30 | binder_call(dumpstate, storaged) |
Keun-young Park | 43e8fae | 2017-03-03 13:13:25 -0800 | [diff] [blame] | 31 | |
Yao Chen | b10ff33 | 2018-01-17 16:17:28 -0800 | [diff] [blame] | 32 | # Allow dumpstate to make binder calls to statsd |
| 33 | binder_call(dumpstate, statsd) |
| 34 | |
Joel Galenson | 7c275a6 | 2018-11-13 12:35:17 -0800 | [diff] [blame] | 35 | # Allow dumpstate to talk to gpuservice over binder |
| 36 | binder_call(dumpstate, gpuservice); |
| 37 | |
Joel Galenson | 657470a | 2018-12-05 11:01:04 -0800 | [diff] [blame] | 38 | # Allow dumpstate to talk to idmap over binder |
| 39 | binder_call(dumpstate, idmap); |
| 40 | |
Alex Hong | 906c724 | 2020-11-10 14:12:38 +0800 | [diff] [blame] | 41 | # Allow dumpstate to talk to profcollectd over binder |
| 42 | userdebug_or_eng(` |
| 43 | binder_call(dumpstate, profcollectd) |
| 44 | ') |
| 45 | |
Keun-young Park | 43e8fae | 2017-03-03 13:13:25 -0800 | [diff] [blame] | 46 | # Collect metrics on boot time created by init |
| 47 | get_prop(dumpstate, boottime_prop) |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 48 | |
| 49 | # Signal native processes to dump their stack. |
| 50 | allow dumpstate { |
Chong Zhang | 81f5b9f | 2020-10-15 12:38:30 -0700 | [diff] [blame] | 51 | mediatranscoding |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 52 | statsd |
Chalard Jean | a4c9f7b | 2019-04-05 17:33:56 +0900 | [diff] [blame] | 53 | netd |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 54 | }:process signal; |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 55 | |
| 56 | # For collecting bugreports. |
| 57 | allow dumpstate debugfs_wakeup_sources:file r_file_perms; |
| 58 | allow dumpstate dev_type:blk_file getattr; |
| 59 | allow dumpstate webview_zygote:process signal; |
Hridya Valsaraju | 6217b66 | 2021-01-10 21:09:37 -0800 | [diff] [blame] | 60 | allow dumpstate sysfs_dmabuf_stats:file r_file_perms; |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 61 | dontaudit dumpstate update_engine:binder call; |
Alistair Delva | 2bbf1ce | 2020-12-02 16:04:12 -0800 | [diff] [blame] | 62 | |
| 63 | # Read files in /proc |
| 64 | allow dumpstate { |
| 65 | proc_net_tcp_udp |
| 66 | proc_pid_max |
| 67 | }:file r_file_perms; |
Joe Onorato | 5536a08 | 2018-12-07 17:20:14 -0800 | [diff] [blame] | 68 | |
| 69 | # For comminucating with the system process to do confirmation ui. |
| 70 | binder_call(dumpstate, incidentcompanion_service) |
David Anderson | dc2a787 | 2019-09-06 14:52:21 -0700 | [diff] [blame] | 71 | |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 72 | # Set properties. |
| 73 | # dumpstate_prop is used to share state with the Shell app. |
| 74 | set_prop(dumpstate, dumpstate_prop) |
| 75 | set_prop(dumpstate, exported_dumpstate_prop) |
| 76 | |
| 77 | # dumpstate_options_prop is used to pass extra command-line args. |
| 78 | set_prop(dumpstate, dumpstate_options_prop) |
| 79 | |
| 80 | # Allow dumpstate to kill vendor dumpstate service by init |
| 81 | set_prop(dumpstate, ctl_dumpstate_prop) |
| 82 | |
David Anderson | dc2a787 | 2019-09-06 14:52:21 -0700 | [diff] [blame] | 83 | # For dumping dynamic partition information. |
| 84 | set_prop(dumpstate, lpdumpd_prop) |
| 85 | binder_call(dumpstate, lpdumpd) |
David Anderson | 14eaa6c | 2019-09-09 17:52:06 -0700 | [diff] [blame] | 86 | |
| 87 | # For dumping device-mapper and snapshot information. |
| 88 | allow dumpstate gsid_exec:file rx_file_perms; |
| 89 | set_prop(dumpstate, ctl_gsid_prop) |
| 90 | binder_call(dumpstate, gsid) |
Yifan Hong | 91709db | 2019-10-29 14:12:16 -0700 | [diff] [blame] | 91 | |
| 92 | r_dir_file(dumpstate, ota_metadata_file) |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 93 | |
| 94 | # For starting (and killing) perfetto --save-for-bugreport. If a labelled trace |
| 95 | # is being recorded, the command above will serialize it into |
| 96 | # /data/misc/perfetto-traces/bugreport/*.pftrace . |
| 97 | domain_auto_trans(dumpstate, perfetto_exec, perfetto) |
| 98 | allow dumpstate perfetto:process signal; |
| 99 | allow dumpstate perfetto_traces_data_file:dir { search }; |
| 100 | allow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms; |
| 101 | allow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink }; |
| 102 | |
| 103 | # When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null |
| 104 | # (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport |
| 105 | # zip file. These rules are to allow perfetto.te to inherit dumpstate's |
| 106 | # /dev/null. |
| 107 | allow perfetto dumpstate_tmpfs:file rw_file_perms; |
| 108 | allow perfetto dumpstate:fd use; |