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 | |
Chris Morin | 1d88bf5 | 2022-02-12 13:52:39 -0800 | [diff] [blame] | 9 | # Create tmpfs files for using memfd descriptors to get output from child |
| 10 | # processes. |
| 11 | tmpfs_domain(dumpstate) |
| 12 | |
Joel Scherpelz | 5e901bb | 2017-04-25 11:53:51 +0900 | [diff] [blame] | 13 | # Acquire advisory lock on /system/etc/xtables.lock from ip[6]tables |
| 14 | allow dumpstate system_file:file lock; |
| 15 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 16 | allow dumpstate storaged_exec:file rx_file_perms; |
| 17 | |
Hongming Jin | 58f8341 | 2021-02-09 12:03:40 -0800 | [diff] [blame] | 18 | # /data/misc/a11ytrace for accessibility traces |
| 19 | userdebug_or_eng(` |
| 20 | allow dumpstate accessibility_trace_data_file:dir r_dir_perms; |
| 21 | allow dumpstate accessibility_trace_data_file:file r_file_perms; |
| 22 | ') |
| 23 | |
Vishnu Nair | 2d6942d | 2017-11-17 08:23:32 -0800 | [diff] [blame] | 24 | # /data/misc/wmtrace for wm traces |
| 25 | userdebug_or_eng(` |
| 26 | allow dumpstate wm_trace_data_file:dir r_dir_perms; |
| 27 | allow dumpstate wm_trace_data_file:file r_file_perms; |
| 28 | ') |
| 29 | |
Mike Ma | de3a3e4 | 2018-12-03 10:35:40 -0800 | [diff] [blame] | 30 | # Allow dumpstate to make binder calls to incidentd |
| 31 | binder_call(dumpstate, incidentd) |
| 32 | |
Thiébaud Weksteen | 3b1c843 | 2023-01-04 12:57:11 +1100 | [diff] [blame] | 33 | # Kill incident in case of a timeout |
| 34 | allow dumpstate incident:process { signal sigkill }; |
| 35 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 36 | # Allow dumpstate to make binder calls to storaged service |
| 37 | binder_call(dumpstate, storaged) |
Keun-young Park | 43e8fae | 2017-03-03 13:13:25 -0800 | [diff] [blame] | 38 | |
Yao Chen | b10ff33 | 2018-01-17 16:17:28 -0800 | [diff] [blame] | 39 | # Allow dumpstate to make binder calls to statsd |
| 40 | binder_call(dumpstate, statsd) |
| 41 | |
Joel Galenson | 7c275a6 | 2018-11-13 12:35:17 -0800 | [diff] [blame] | 42 | # Allow dumpstate to talk to gpuservice over binder |
| 43 | binder_call(dumpstate, gpuservice); |
| 44 | |
Joel Galenson | 657470a | 2018-12-05 11:01:04 -0800 | [diff] [blame] | 45 | # Allow dumpstate to talk to idmap over binder |
| 46 | binder_call(dumpstate, idmap); |
| 47 | |
Alex Hong | 906c724 | 2020-11-10 14:12:38 +0800 | [diff] [blame] | 48 | # Allow dumpstate to talk to profcollectd over binder |
| 49 | userdebug_or_eng(` |
| 50 | binder_call(dumpstate, profcollectd) |
| 51 | ') |
| 52 | |
Keun-young Park | 43e8fae | 2017-03-03 13:13:25 -0800 | [diff] [blame] | 53 | # Collect metrics on boot time created by init |
| 54 | get_prop(dumpstate, boottime_prop) |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 55 | |
| 56 | # Signal native processes to dump their stack. |
| 57 | allow dumpstate { |
Chong Zhang | 81f5b9f | 2020-10-15 12:38:30 -0700 | [diff] [blame] | 58 | mediatranscoding |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 59 | statsd |
Chalard Jean | a4c9f7b | 2019-04-05 17:33:56 +0900 | [diff] [blame] | 60 | netd |
Andreas Gampe | 7468db6 | 2018-01-24 17:56:25 -0800 | [diff] [blame] | 61 | }:process signal; |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 62 | |
Eric Biggers | f9519a6 | 2021-05-04 20:59:32 -0700 | [diff] [blame] | 63 | userdebug_or_eng(` |
| 64 | allow dumpstate keystore:process signal; |
| 65 | ') |
| 66 | |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 67 | # For collecting bugreports. |
Hridya Valsaraju | 23f9f51 | 2021-05-04 22:01:51 -0700 | [diff] [blame] | 68 | no_debugfs_restriction(` |
| 69 | allow dumpstate debugfs_wakeup_sources:file r_file_perms; |
| 70 | ') |
| 71 | |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 72 | allow dumpstate dev_type:blk_file getattr; |
| 73 | allow dumpstate webview_zygote:process signal; |
Hridya Valsaraju | 6217b66 | 2021-01-10 21:09:37 -0800 | [diff] [blame] | 74 | allow dumpstate sysfs_dmabuf_stats:file r_file_perms; |
Joel Galenson | 03ff9f9 | 2018-02-14 14:32:38 -0800 | [diff] [blame] | 75 | dontaudit dumpstate update_engine:binder call; |
Alistair Delva | 2bbf1ce | 2020-12-02 16:04:12 -0800 | [diff] [blame] | 76 | |
| 77 | # Read files in /proc |
| 78 | allow dumpstate { |
| 79 | proc_net_tcp_udp |
| 80 | proc_pid_max |
| 81 | }:file r_file_perms; |
Joe Onorato | 5536a08 | 2018-12-07 17:20:14 -0800 | [diff] [blame] | 82 | |
| 83 | # For comminucating with the system process to do confirmation ui. |
| 84 | binder_call(dumpstate, incidentcompanion_service) |
David Anderson | dc2a787 | 2019-09-06 14:52:21 -0700 | [diff] [blame] | 85 | |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 86 | # Set properties. |
| 87 | # dumpstate_prop is used to share state with the Shell app. |
| 88 | set_prop(dumpstate, dumpstate_prop) |
| 89 | set_prop(dumpstate, exported_dumpstate_prop) |
| 90 | |
| 91 | # dumpstate_options_prop is used to pass extra command-line args. |
| 92 | set_prop(dumpstate, dumpstate_options_prop) |
| 93 | |
| 94 | # Allow dumpstate to kill vendor dumpstate service by init |
| 95 | set_prop(dumpstate, ctl_dumpstate_prop) |
| 96 | |
David Anderson | dc2a787 | 2019-09-06 14:52:21 -0700 | [diff] [blame] | 97 | # For dumping dynamic partition information. |
| 98 | set_prop(dumpstate, lpdumpd_prop) |
| 99 | binder_call(dumpstate, lpdumpd) |
David Anderson | 14eaa6c | 2019-09-09 17:52:06 -0700 | [diff] [blame] | 100 | |
Enrico Granata | 645c390 | 2021-10-01 13:11:36 -0600 | [diff] [blame] | 101 | # For dumping hypervisor information. |
| 102 | get_prop(dumpstate, hypervisor_prop) |
| 103 | |
David Anderson | 14eaa6c | 2019-09-09 17:52:06 -0700 | [diff] [blame] | 104 | # For dumping device-mapper and snapshot information. |
| 105 | allow dumpstate gsid_exec:file rx_file_perms; |
| 106 | set_prop(dumpstate, ctl_gsid_prop) |
| 107 | binder_call(dumpstate, gsid) |
Yifan Hong | 91709db | 2019-10-29 14:12:16 -0700 | [diff] [blame] | 108 | |
| 109 | r_dir_file(dumpstate, ota_metadata_file) |
Primiano Tucci | 2f99809 | 2021-01-07 17:12:21 +0000 | [diff] [blame] | 110 | |
| 111 | # For starting (and killing) perfetto --save-for-bugreport. If a labelled trace |
| 112 | # is being recorded, the command above will serialize it into |
| 113 | # /data/misc/perfetto-traces/bugreport/*.pftrace . |
| 114 | domain_auto_trans(dumpstate, perfetto_exec, perfetto) |
| 115 | allow dumpstate perfetto:process signal; |
| 116 | allow dumpstate perfetto_traces_data_file:dir { search }; |
| 117 | allow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms; |
| 118 | allow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink }; |
| 119 | |
| 120 | # When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null |
| 121 | # (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport |
| 122 | # zip file. These rules are to allow perfetto.te to inherit dumpstate's |
| 123 | # /dev/null. |
| 124 | allow perfetto dumpstate_tmpfs:file rw_file_perms; |
| 125 | allow perfetto dumpstate:fd use; |
Ramji Jiyani | 3b59a53 | 2022-03-11 21:21:57 +0000 | [diff] [blame] | 126 | |
| 127 | # system_dlkm_file for /system_dlkm partition |
| 128 | allow dumpstate system_dlkm_file:dir getattr; |
Mårten Kongstad | 098e909 | 2022-09-20 14:19:30 +0200 | [diff] [blame] | 129 | |
| 130 | # Allow dumpstate to execute derive_sdk in its own domain |
| 131 | domain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk) |