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