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# Allow dumpstate to talk to automotive_display_service over binder 60*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, automotive_display_service) 61*e4a36f41SAndroid Build Coastguard Worker 62*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to virtual_camera service over binder 63*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, virtual_camera) 64*e4a36f41SAndroid Build Coastguard Worker 65*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to ot_daemon service over binder 66*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, ot_daemon) 67*e4a36f41SAndroid Build Coastguard Worker 68*e4a36f41SAndroid Build Coastguard Worker# Collect metrics on boot time created by init 69*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, boottime_prop) 70*e4a36f41SAndroid Build Coastguard Worker 71*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, misctrl_prop) 72*e4a36f41SAndroid Build Coastguard Worker 73*e4a36f41SAndroid Build Coastguard Worker# Signal native processes to dump their stack. 74*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 75*e4a36f41SAndroid Build Coastguard Worker mediatranscoding 76*e4a36f41SAndroid Build Coastguard Worker statsd 77*e4a36f41SAndroid Build Coastguard Worker netd 78*e4a36f41SAndroid Build Coastguard Worker virtual_camera 79*e4a36f41SAndroid Build Coastguard Worker ot_daemon 80*e4a36f41SAndroid Build Coastguard Worker}:process signal; 81*e4a36f41SAndroid Build Coastguard Worker 82*e4a36f41SAndroid Build Coastguard Worker# Only allow dumpstate to dump Keystore on debuggable builds. 83*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 84*e4a36f41SAndroid Build Coastguard Worker allow dumpstate keystore:process signal; 85*e4a36f41SAndroid Build Coastguard Worker') 86*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate keystore:process { signal }; 87*e4a36f41SAndroid Build Coastguard Worker 88*e4a36f41SAndroid Build Coastguard Worker# For collecting bugreports. 89*e4a36f41SAndroid Build Coastguard Workerno_debugfs_restriction(` 90*e4a36f41SAndroid Build Coastguard Worker allow dumpstate debugfs_wakeup_sources:file r_file_perms; 91*e4a36f41SAndroid Build Coastguard Worker') 92*e4a36f41SAndroid Build Coastguard Worker 93*e4a36f41SAndroid Build Coastguard Workerallow dumpstate dev_type:blk_file getattr; 94*e4a36f41SAndroid Build Coastguard Workerallow dumpstate webview_zygote:process signal; 95*e4a36f41SAndroid Build Coastguard Workerallow dumpstate sysfs_dmabuf_stats:file r_file_perms; 96*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate update_engine:binder call; 97*e4a36f41SAndroid Build Coastguard Worker 98*e4a36f41SAndroid Build Coastguard Worker# Read files in /proc 99*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 100*e4a36f41SAndroid Build Coastguard Worker config_gz 101*e4a36f41SAndroid Build Coastguard Worker proc_net_tcp_udp 102*e4a36f41SAndroid Build Coastguard Worker proc_pid_max 103*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 104*e4a36f41SAndroid Build Coastguard Worker 105*e4a36f41SAndroid Build Coastguard Worker# For comminucating with the system process to do confirmation ui. 106*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, incidentcompanion_service) 107*e4a36f41SAndroid Build Coastguard Worker 108*e4a36f41SAndroid Build Coastguard Worker# Set properties. 109*e4a36f41SAndroid Build Coastguard Worker# dumpstate_prop is used to share state with the Shell app. 110*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_prop) 111*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, exported_dumpstate_prop) 112*e4a36f41SAndroid Build Coastguard Worker 113*e4a36f41SAndroid Build Coastguard Worker# dumpstate_options_prop is used to pass extra command-line args. 114*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_options_prop) 115*e4a36f41SAndroid Build Coastguard Worker 116*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to kill vendor dumpstate service by init 117*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_dumpstate_prop) 118*e4a36f41SAndroid Build Coastguard Worker 119*e4a36f41SAndroid Build Coastguard Worker# For dumping dynamic partition information. 120*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, lpdumpd_prop) 121*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, lpdumpd) 122*e4a36f41SAndroid Build Coastguard Worker 123*e4a36f41SAndroid Build Coastguard Worker# For dumping hypervisor information. 124*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, hypervisor_prop) 125*e4a36f41SAndroid Build Coastguard Worker 126*e4a36f41SAndroid Build Coastguard Worker# For dumping device-mapper and snapshot information. 127*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gsid_exec:file rx_file_perms; 128*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_gsid_prop) 129*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, gsid) 130*e4a36f41SAndroid Build Coastguard Worker 131*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, ota_metadata_file) 132*e4a36f41SAndroid Build Coastguard Worker 133*e4a36f41SAndroid Build Coastguard Worker# For starting (and killing) perfetto --save-for-bugreport. If a labelled trace 134*e4a36f41SAndroid Build Coastguard Worker# is being recorded, the command above will serialize it into 135*e4a36f41SAndroid Build Coastguard Worker# /data/misc/perfetto-traces/bugreport/*.pftrace . 136*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, perfetto_exec, perfetto) 137*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto:process signal; 138*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_data_file:dir { search }; 139*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms; 140*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink }; 141*e4a36f41SAndroid Build Coastguard Worker 142*e4a36f41SAndroid Build Coastguard Worker# When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null 143*e4a36f41SAndroid Build Coastguard Worker# (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport 144*e4a36f41SAndroid Build Coastguard Worker# zip file. These rules are to allow perfetto.te to inherit dumpstate's 145*e4a36f41SAndroid Build Coastguard Worker# /dev/null. 146*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate_tmpfs:file rw_file_perms; 147*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate:fd use; 148*e4a36f41SAndroid Build Coastguard Worker 149*e4a36f41SAndroid Build Coastguard Worker# system_dlkm_file for /system_dlkm partition 150*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_dlkm_file:dir getattr; 151*e4a36f41SAndroid Build Coastguard Worker 152*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to execute derive_sdk in its own domain 153*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk) 154