xref: /aosp_15_r20/system/sepolicy/prebuilts/api/34.0/private/dumpstate.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workertypeattribute dumpstate coredomain;
2*e4a36f41SAndroid Build Coastguard Workertype dumpstate_tmpfs, file_type;
3*e4a36f41SAndroid Build Coastguard Worker
4*e4a36f41SAndroid Build Coastguard Workerinit_daemon_domain(dumpstate)
5*e4a36f41SAndroid Build Coastguard Worker
6*e4a36f41SAndroid Build Coastguard Worker# Execute and transition to the vdc domain
7*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, vdc_exec, vdc)
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Worker# Create tmpfs files for using memfd descriptors to get output from child
10*e4a36f41SAndroid Build Coastguard Worker# processes.
11*e4a36f41SAndroid Build Coastguard Workertmpfs_domain(dumpstate)
12*e4a36f41SAndroid Build Coastguard Worker
13*e4a36f41SAndroid Build Coastguard Worker# Acquire advisory lock on /system/etc/xtables.lock from ip[6]tables
14*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_file:file lock;
15*e4a36f41SAndroid Build Coastguard Worker
16*e4a36f41SAndroid Build Coastguard Workerallow dumpstate storaged_exec:file rx_file_perms;
17*e4a36f41SAndroid Build Coastguard Worker
18*e4a36f41SAndroid Build Coastguard Worker# /data/misc/a11ytrace for accessibility traces
19*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
20*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate accessibility_trace_data_file:dir r_dir_perms;
21*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate accessibility_trace_data_file:file r_file_perms;
22*e4a36f41SAndroid Build Coastguard Worker')
23*e4a36f41SAndroid Build Coastguard Worker
24*e4a36f41SAndroid Build Coastguard Worker# /data/misc/wmtrace for wm traces
25*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
26*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate wm_trace_data_file:dir r_dir_perms;
27*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate wm_trace_data_file:file r_file_perms;
28*e4a36f41SAndroid Build Coastguard Worker')
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker# /data/system/dropbox for dropbox entries
31*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
32*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate dropbox_data_file:dir r_dir_perms;
33*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate dropbox_data_file:file r_file_perms;
34*e4a36f41SAndroid Build Coastguard Worker')
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to incidentd
37*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, incidentd)
38*e4a36f41SAndroid Build Coastguard Worker
39*e4a36f41SAndroid Build Coastguard Worker# Kill incident in case of a timeout
40*e4a36f41SAndroid Build Coastguard Workerallow dumpstate incident:process { signal sigkill };
41*e4a36f41SAndroid Build Coastguard Worker
42*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to storaged service
43*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, storaged)
44*e4a36f41SAndroid Build Coastguard Worker
45*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to statsd
46*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, statsd)
47*e4a36f41SAndroid Build Coastguard Worker
48*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to gpuservice over binder
49*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, gpuservice);
50*e4a36f41SAndroid Build Coastguard Worker
51*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to idmap over binder
52*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, idmap);
53*e4a36f41SAndroid Build Coastguard Worker
54*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to profcollectd over binder
55*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
56*e4a36f41SAndroid Build Coastguard Worker  binder_call(dumpstate, profcollectd)
57*e4a36f41SAndroid Build Coastguard Worker')
58*e4a36f41SAndroid Build Coastguard Worker
59*e4a36f41SAndroid Build Coastguard Worker# Collect metrics on boot time created by init
60*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, boottime_prop)
61*e4a36f41SAndroid Build Coastguard Worker
62*e4a36f41SAndroid Build Coastguard Worker# Signal native processes to dump their stack.
63*e4a36f41SAndroid Build Coastguard Workerallow dumpstate {
64*e4a36f41SAndroid Build Coastguard Worker  mediatranscoding
65*e4a36f41SAndroid Build Coastguard Worker  statsd
66*e4a36f41SAndroid Build Coastguard Worker  netd
67*e4a36f41SAndroid Build Coastguard Worker}:process signal;
68*e4a36f41SAndroid Build Coastguard Worker
69*e4a36f41SAndroid Build Coastguard Worker# Only allow dumpstate to dump Keystore on debuggable builds.
70*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
71*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate keystore:process signal;
72*e4a36f41SAndroid Build Coastguard Worker')
73*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate keystore:process { signal };
74*e4a36f41SAndroid Build Coastguard Worker
75*e4a36f41SAndroid Build Coastguard Worker# For collecting bugreports.
76*e4a36f41SAndroid Build Coastguard Workerno_debugfs_restriction(`
77*e4a36f41SAndroid Build Coastguard Worker  allow dumpstate debugfs_wakeup_sources:file r_file_perms;
78*e4a36f41SAndroid Build Coastguard Worker')
79*e4a36f41SAndroid Build Coastguard Worker
80*e4a36f41SAndroid Build Coastguard Workerallow dumpstate dev_type:blk_file getattr;
81*e4a36f41SAndroid Build Coastguard Workerallow dumpstate webview_zygote:process signal;
82*e4a36f41SAndroid Build Coastguard Workerallow dumpstate sysfs_dmabuf_stats:file r_file_perms;
83*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate update_engine:binder call;
84*e4a36f41SAndroid Build Coastguard Worker
85*e4a36f41SAndroid Build Coastguard Worker# Read files in /proc
86*e4a36f41SAndroid Build Coastguard Workerallow dumpstate {
87*e4a36f41SAndroid Build Coastguard Worker  proc_net_tcp_udp
88*e4a36f41SAndroid Build Coastguard Worker  proc_pid_max
89*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms;
90*e4a36f41SAndroid Build Coastguard Worker
91*e4a36f41SAndroid Build Coastguard Worker# For comminucating with the system process to do confirmation ui.
92*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, incidentcompanion_service)
93*e4a36f41SAndroid Build Coastguard Worker
94*e4a36f41SAndroid Build Coastguard Worker# Set properties.
95*e4a36f41SAndroid Build Coastguard Worker# dumpstate_prop is used to share state with the Shell app.
96*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_prop)
97*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, exported_dumpstate_prop)
98*e4a36f41SAndroid Build Coastguard Worker
99*e4a36f41SAndroid Build Coastguard Worker# dumpstate_options_prop is used to pass extra command-line args.
100*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_options_prop)
101*e4a36f41SAndroid Build Coastguard Worker
102*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to kill vendor dumpstate service by init
103*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_dumpstate_prop)
104*e4a36f41SAndroid Build Coastguard Worker
105*e4a36f41SAndroid Build Coastguard Worker# For dumping dynamic partition information.
106*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, lpdumpd_prop)
107*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, lpdumpd)
108*e4a36f41SAndroid Build Coastguard Worker
109*e4a36f41SAndroid Build Coastguard Worker# For dumping hypervisor information.
110*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, hypervisor_prop)
111*e4a36f41SAndroid Build Coastguard Worker
112*e4a36f41SAndroid Build Coastguard Worker# For dumping device-mapper and snapshot information.
113*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gsid_exec:file rx_file_perms;
114*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_gsid_prop)
115*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, gsid)
116*e4a36f41SAndroid Build Coastguard Worker
117*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, ota_metadata_file)
118*e4a36f41SAndroid Build Coastguard Worker
119*e4a36f41SAndroid Build Coastguard Worker# For starting (and killing) perfetto --save-for-bugreport. If a labelled trace
120*e4a36f41SAndroid Build Coastguard Worker# is being recorded, the command above will serialize it into
121*e4a36f41SAndroid Build Coastguard Worker# /data/misc/perfetto-traces/bugreport/*.pftrace .
122*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, perfetto_exec, perfetto)
123*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto:process signal;
124*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_data_file:dir { search };
125*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms;
126*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink };
127*e4a36f41SAndroid Build Coastguard Worker
128*e4a36f41SAndroid Build Coastguard Worker# When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null
129*e4a36f41SAndroid Build Coastguard Worker# (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport
130*e4a36f41SAndroid Build Coastguard Worker# zip file. These rules are to allow perfetto.te to inherit dumpstate's
131*e4a36f41SAndroid Build Coastguard Worker# /dev/null.
132*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate_tmpfs:file rw_file_perms;
133*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate:fd use;
134*e4a36f41SAndroid Build Coastguard Worker
135*e4a36f41SAndroid Build Coastguard Worker# system_dlkm_file for /system_dlkm partition
136*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_dlkm_file:dir getattr;
137*e4a36f41SAndroid Build Coastguard Worker
138*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to execute derive_sdk in its own domain
139*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk)
140