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