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