blob: 67986673d7b6d84c143814ac0aea0355f5dc3b59 [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute dumpstate coredomain;
Primiano Tucci2f998092021-01-07 17:12:21 +00002type dumpstate_tmpfs, file_type;
Alex Klyubinf5446eb2017-03-23 14:27:32 -07003
dcashmancc39f632016-07-22 13:13:11 -07004init_daemon_domain(dumpstate)
5
6# Execute and transition to the vdc domain
7domain_auto_trans(dumpstate, vdc_exec, vdc)
dcashman2e00e632016-10-12 14:58:09 -07008
Chris Morin1d88bf52022-02-12 13:52:39 -08009# Create tmpfs files for using memfd descriptors to get output from child
10# processes.
11tmpfs_domain(dumpstate)
12
Joel Scherpelz5e901bb2017-04-25 11:53:51 +090013# Acquire advisory lock on /system/etc/xtables.lock from ip[6]tables
14allow dumpstate system_file:file lock;
15
ynwange68d2d22016-07-01 12:18:54 -070016allow dumpstate storaged_exec:file rx_file_perms;
17
Hongming Jin58f83412021-02-09 12:03:40 -080018# /data/misc/a11ytrace for accessibility traces
19userdebug_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 Nair2d6942d2017-11-17 08:23:32 -080024# /data/misc/wmtrace for wm traces
25userdebug_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 Sharkeyef5e5c82023-02-06 14:25:48 -070030# /data/system/dropbox for dropbox entries
31userdebug_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 Made3a3e42018-12-03 10:35:40 -080036# Allow dumpstate to make binder calls to incidentd
37binder_call(dumpstate, incidentd)
38
Thiébaud Weksteen3b1c8432023-01-04 12:57:11 +110039# Kill incident in case of a timeout
40allow dumpstate incident:process { signal sigkill };
41
ynwange68d2d22016-07-01 12:18:54 -070042# Allow dumpstate to make binder calls to storaged service
43binder_call(dumpstate, storaged)
Keun-young Park43e8fae2017-03-03 13:13:25 -080044
Yao Chenb10ff332018-01-17 16:17:28 -080045# Allow dumpstate to make binder calls to statsd
46binder_call(dumpstate, statsd)
47
Joel Galenson7c275a62018-11-13 12:35:17 -080048# Allow dumpstate to talk to gpuservice over binder
49binder_call(dumpstate, gpuservice);
50
Joel Galenson657470a2018-12-05 11:01:04 -080051# Allow dumpstate to talk to idmap over binder
52binder_call(dumpstate, idmap);
53
Alex Hong906c7242020-11-10 14:12:38 +080054# Allow dumpstate to talk to profcollectd over binder
55userdebug_or_eng(`
56 binder_call(dumpstate, profcollectd)
57')
58
Changyeon Jo152a2f12023-09-26 18:44:35 +000059# Allow dumpstate to talk to automotive_display_service over binder
60binder_call(dumpstate, automotive_display_service)
61
Jan Sebechlebskyde644172023-11-30 10:57:16 +010062# Allow dumpstate to talk to virtual_camera service over binder
63binder_call(dumpstate, virtual_camera)
64
Kangping Donge1ee7682023-12-01 13:02:38 +080065# Allow dumpstate to talk to ot_daemon service over binder
66binder_call(dumpstate, ot_daemon)
67
Keun-young Park43e8fae2017-03-03 13:13:25 -080068# Collect metrics on boot time created by init
69get_prop(dumpstate, boottime_prop)
Andreas Gampe7468db62018-01-24 17:56:25 -080070
71# Signal native processes to dump their stack.
72allow dumpstate {
Chong Zhang81f5b9f2020-10-15 12:38:30 -070073 mediatranscoding
Andreas Gampe7468db62018-01-24 17:56:25 -080074 statsd
Chalard Jeana4c9f7b2019-04-05 17:33:56 +090075 netd
Jan Sebechlebskyde644172023-11-30 10:57:16 +010076 virtual_camera
Kangping Donge1ee7682023-12-01 13:02:38 +080077 ot_daemon
Andreas Gampe7468db62018-01-24 17:56:25 -080078}:process signal;
Joel Galenson03ff9f92018-02-14 14:32:38 -080079
David Drysdalee1075f72023-03-17 12:21:32 +000080# Only allow dumpstate to dump Keystore on debuggable builds.
Eric Biggersf9519a62021-05-04 20:59:32 -070081userdebug_or_eng(`
82 allow dumpstate keystore:process signal;
83')
David Drysdalee1075f72023-03-17 12:21:32 +000084dontaudit dumpstate keystore:process { signal };
Eric Biggersf9519a62021-05-04 20:59:32 -070085
Joel Galenson03ff9f92018-02-14 14:32:38 -080086# For collecting bugreports.
Hridya Valsaraju23f9f512021-05-04 22:01:51 -070087no_debugfs_restriction(`
88 allow dumpstate debugfs_wakeup_sources:file r_file_perms;
89')
90
Joel Galenson03ff9f92018-02-14 14:32:38 -080091allow dumpstate dev_type:blk_file getattr;
92allow dumpstate webview_zygote:process signal;
Hridya Valsaraju6217b662021-01-10 21:09:37 -080093allow dumpstate sysfs_dmabuf_stats:file r_file_perms;
Joel Galenson03ff9f92018-02-14 14:32:38 -080094dontaudit dumpstate update_engine:binder call;
Alistair Delva2bbf1ce2020-12-02 16:04:12 -080095
96# Read files in /proc
97allow dumpstate {
Steven Moreland832dc372023-12-21 01:22:13 +000098 config_gz
Alistair Delva2bbf1ce2020-12-02 16:04:12 -080099 proc_net_tcp_udp
100 proc_pid_max
101}:file r_file_perms;
Joe Onorato5536a082018-12-07 17:20:14 -0800102
103# For comminucating with the system process to do confirmation ui.
104binder_call(dumpstate, incidentcompanion_service)
David Andersondc2a7872019-09-06 14:52:21 -0700105
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900106# Set properties.
107# dumpstate_prop is used to share state with the Shell app.
108set_prop(dumpstate, dumpstate_prop)
109set_prop(dumpstate, exported_dumpstate_prop)
110
111# dumpstate_options_prop is used to pass extra command-line args.
112set_prop(dumpstate, dumpstate_options_prop)
113
114# Allow dumpstate to kill vendor dumpstate service by init
115set_prop(dumpstate, ctl_dumpstate_prop)
116
David Andersondc2a7872019-09-06 14:52:21 -0700117# For dumping dynamic partition information.
118set_prop(dumpstate, lpdumpd_prop)
119binder_call(dumpstate, lpdumpd)
David Anderson14eaa6c2019-09-09 17:52:06 -0700120
Enrico Granata645c3902021-10-01 13:11:36 -0600121# For dumping hypervisor information.
122get_prop(dumpstate, hypervisor_prop)
123
David Anderson14eaa6c2019-09-09 17:52:06 -0700124# For dumping device-mapper and snapshot information.
125allow dumpstate gsid_exec:file rx_file_perms;
126set_prop(dumpstate, ctl_gsid_prop)
127binder_call(dumpstate, gsid)
Yifan Hong91709db2019-10-29 14:12:16 -0700128
129r_dir_file(dumpstate, ota_metadata_file)
Primiano Tucci2f998092021-01-07 17:12:21 +0000130
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 .
134domain_auto_trans(dumpstate, perfetto_exec, perfetto)
135allow dumpstate perfetto:process signal;
136allow dumpstate perfetto_traces_data_file:dir { search };
137allow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms;
138allow 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.
144allow perfetto dumpstate_tmpfs:file rw_file_perms;
145allow perfetto dumpstate:fd use;
Ramji Jiyani3b59a532022-03-11 21:21:57 +0000146
147# system_dlkm_file for /system_dlkm partition
148allow dumpstate system_dlkm_file:dir getattr;
Mårten Kongstad098e9092022-09-20 14:19:30 +0200149
150# Allow dumpstate to execute derive_sdk in its own domain
151domain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk)