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 Workerr_dir_file(dumpstate, aconfig_storage_metadata_file); 37*e4a36f41SAndroid Build Coastguard Worker 38*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to incidentd 39*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, incidentd) 40*e4a36f41SAndroid Build Coastguard Worker 41*e4a36f41SAndroid Build Coastguard Worker# Kill incident in case of a timeout 42*e4a36f41SAndroid Build Coastguard Workerallow dumpstate incident:process { signal sigkill }; 43*e4a36f41SAndroid Build Coastguard Worker 44*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to storaged service 45*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, storaged) 46*e4a36f41SAndroid Build Coastguard Worker 47*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to statsd 48*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, statsd) 49*e4a36f41SAndroid Build Coastguard Worker 50*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to gpuservice over binder 51*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, gpuservice); 52*e4a36f41SAndroid Build Coastguard Worker 53*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to idmap over binder 54*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, idmap); 55*e4a36f41SAndroid Build Coastguard Worker 56*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to profcollectd over binder 57*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 58*e4a36f41SAndroid Build Coastguard Worker binder_call(dumpstate, profcollectd) 59*e4a36f41SAndroid Build Coastguard Worker') 60*e4a36f41SAndroid Build Coastguard Worker 61*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to automotive_display_service over binder 62*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, automotive_display_service) 63*e4a36f41SAndroid Build Coastguard Worker 64*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to virtual_camera service over binder 65*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, virtual_camera) 66*e4a36f41SAndroid Build Coastguard Worker 67*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to ot_daemon service over binder 68*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, ot_daemon) 69*e4a36f41SAndroid Build Coastguard Worker 70*e4a36f41SAndroid Build Coastguard Worker# Collect metrics on boot time created by init 71*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, boottime_prop) 72*e4a36f41SAndroid Build Coastguard Worker 73*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, misctrl_prop) 74*e4a36f41SAndroid Build Coastguard Worker 75*e4a36f41SAndroid Build Coastguard Worker# Signal native processes to dump their stack. 76*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 77*e4a36f41SAndroid Build Coastguard Worker mediatranscoding 78*e4a36f41SAndroid Build Coastguard Worker statsd 79*e4a36f41SAndroid Build Coastguard Worker netd 80*e4a36f41SAndroid Build Coastguard Worker virtual_camera 81*e4a36f41SAndroid Build Coastguard Worker ot_daemon 82*e4a36f41SAndroid Build Coastguard Worker}:process signal; 83*e4a36f41SAndroid Build Coastguard Worker 84*e4a36f41SAndroid Build Coastguard Worker# Only allow dumpstate to dump Keystore on debuggable builds. 85*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 86*e4a36f41SAndroid Build Coastguard Worker allow dumpstate keystore:process signal; 87*e4a36f41SAndroid Build Coastguard Worker') 88*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate keystore:process { signal }; 89*e4a36f41SAndroid Build Coastguard Worker 90*e4a36f41SAndroid Build Coastguard Worker# For collecting bugreports. 91*e4a36f41SAndroid Build Coastguard Workerno_debugfs_restriction(` 92*e4a36f41SAndroid Build Coastguard Worker allow dumpstate debugfs_wakeup_sources:file r_file_perms; 93*e4a36f41SAndroid Build Coastguard Worker') 94*e4a36f41SAndroid Build Coastguard Worker 95*e4a36f41SAndroid Build Coastguard Workerallow dumpstate dev_type:blk_file getattr; 96*e4a36f41SAndroid Build Coastguard Workerallow dumpstate webview_zygote:process signal; 97*e4a36f41SAndroid Build Coastguard Workerallow dumpstate sysfs_dmabuf_stats:file r_file_perms; 98*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate update_engine:binder call; 99*e4a36f41SAndroid Build Coastguard Worker 100*e4a36f41SAndroid Build Coastguard Worker# Read files in /proc 101*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 102*e4a36f41SAndroid Build Coastguard Worker config_gz 103*e4a36f41SAndroid Build Coastguard Worker proc_net_tcp_udp 104*e4a36f41SAndroid Build Coastguard Worker proc_pid_max 105*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 106*e4a36f41SAndroid Build Coastguard Worker 107*e4a36f41SAndroid Build Coastguard Worker# For comminucating with the system process to do confirmation ui. 108*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, incidentcompanion_service) 109*e4a36f41SAndroid Build Coastguard Worker 110*e4a36f41SAndroid Build Coastguard Worker# Set properties. 111*e4a36f41SAndroid Build Coastguard Worker# dumpstate_prop is used to share state with the Shell app. 112*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_prop) 113*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, exported_dumpstate_prop) 114*e4a36f41SAndroid Build Coastguard Worker 115*e4a36f41SAndroid Build Coastguard Worker# dumpstate_options_prop is used to pass extra command-line args. 116*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_options_prop) 117*e4a36f41SAndroid Build Coastguard Worker 118*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to kill vendor dumpstate service by init 119*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_dumpstate_prop) 120*e4a36f41SAndroid Build Coastguard Worker 121*e4a36f41SAndroid Build Coastguard Worker# For dumping dynamic partition information. 122*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, lpdumpd_prop) 123*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, lpdumpd) 124*e4a36f41SAndroid Build Coastguard Worker 125*e4a36f41SAndroid Build Coastguard Worker# For dumping hypervisor information. 126*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, hypervisor_prop) 127*e4a36f41SAndroid Build Coastguard Worker 128*e4a36f41SAndroid Build Coastguard Worker# For dumping device-mapper and snapshot information. 129*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gsid_exec:file rx_file_perms; 130*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_gsid_prop) 131*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, gsid) 132*e4a36f41SAndroid Build Coastguard Worker 133*e4a36f41SAndroid Build Coastguard Worker#Allow access to /dev/binderfs/binder_logs 134*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 135*e4a36f41SAndroid Build Coastguard Worker allow dumpstate binderfs_logs_transactions:file r_file_perms; 136*e4a36f41SAndroid Build Coastguard Worker') 137*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate binderfs_logs_transactions:file r_file_perms; 138*e4a36f41SAndroid Build Coastguard Workerallow dumpstate binderfs_logs_transaction_history:file r_file_perms; 139*e4a36f41SAndroid Build Coastguard Worker 140*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, ota_metadata_file) 141*e4a36f41SAndroid Build Coastguard Worker 142*e4a36f41SAndroid Build Coastguard Worker# For starting (and killing) perfetto --save-for-bugreport. If a labelled trace 143*e4a36f41SAndroid Build Coastguard Worker# is being recorded, the command above will serialize it into 144*e4a36f41SAndroid Build Coastguard Worker# /data/misc/perfetto-traces/bugreport/*.pftrace . 145*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, perfetto_exec, perfetto) 146*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto:process signal; 147*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_data_file:dir { search }; 148*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:dir rw_dir_perms; 149*e4a36f41SAndroid Build Coastguard Workerallow dumpstate perfetto_traces_bugreport_data_file:file { r_file_perms unlink }; 150*e4a36f41SAndroid Build Coastguard Worker 151*e4a36f41SAndroid Build Coastguard Worker# When exec-ing /system/bin/perfetto, dumpstates redirects stdio to /dev/null 152*e4a36f41SAndroid Build Coastguard Worker# (which is labelled as dumpstate_tmpfs) to avoid leaking a FD to the bugreport 153*e4a36f41SAndroid Build Coastguard Worker# zip file. These rules are to allow perfetto.te to inherit dumpstate's 154*e4a36f41SAndroid Build Coastguard Worker# /dev/null. 155*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate_tmpfs:file rw_file_perms; 156*e4a36f41SAndroid Build Coastguard Workerallow perfetto dumpstate:fd use; 157*e4a36f41SAndroid Build Coastguard Worker 158*e4a36f41SAndroid Build Coastguard Worker# system_dlkm_file for /system_dlkm partition 159*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_dlkm_file:dir getattr; 160*e4a36f41SAndroid Build Coastguard Worker 161*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to execute derive_sdk in its own domain 162*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(dumpstate, derive_sdk_exec, derive_sdk) 163*e4a36f41SAndroid Build Coastguard Worker 164*e4a36f41SAndroid Build Coastguard Workernet_domain(dumpstate) 165*e4a36f41SAndroid Build Coastguard Workerbinder_use(dumpstate) 166*e4a36f41SAndroid Build Coastguard Workerwakelock_use(dumpstate) 167*e4a36f41SAndroid Build Coastguard Worker 168*e4a36f41SAndroid Build Coastguard Worker# Allow setting process priority, protect from OOM killer, and dropping 169*e4a36f41SAndroid Build Coastguard Worker# privileges by switching UID / GID 170*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { setuid setgid sys_resource }; 171*e4a36f41SAndroid Build Coastguard Worker 172*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to scan through /proc/pid for all processes 173*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, domain) 174*e4a36f41SAndroid Build Coastguard Worker 175*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { 176*e4a36f41SAndroid Build Coastguard Worker # Send signals to processes 177*e4a36f41SAndroid Build Coastguard Worker kill 178*e4a36f41SAndroid Build Coastguard Worker # Run iptables 179*e4a36f41SAndroid Build Coastguard Worker net_raw 180*e4a36f41SAndroid Build Coastguard Worker net_admin 181*e4a36f41SAndroid Build Coastguard Worker}; 182*e4a36f41SAndroid Build Coastguard Worker 183*e4a36f41SAndroid Build Coastguard Worker# Allow executing files on system, such as: 184*e4a36f41SAndroid Build Coastguard Worker# /system/bin/toolbox 185*e4a36f41SAndroid Build Coastguard Worker# /system/bin/logcat 186*e4a36f41SAndroid Build Coastguard Worker# /system/bin/dumpsys 187*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_file:file execute_no_trans; 188*e4a36f41SAndroid Build Coastguard Workernot_full_treble(`allow dumpstate vendor_file:file execute_no_trans;') 189*e4a36f41SAndroid Build Coastguard Workerallow dumpstate toolbox_exec:file rx_file_perms; 190*e4a36f41SAndroid Build Coastguard Worker 191*e4a36f41SAndroid Build Coastguard Worker# hidl searches for files in /system/lib(64)/hw/ 192*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_file:dir r_dir_perms; 193*e4a36f41SAndroid Build Coastguard Worker 194*e4a36f41SAndroid Build Coastguard Worker# Create and write into /data/anr/ 195*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { dac_override dac_read_search chown fowner fsetid }; 196*e4a36f41SAndroid Build Coastguard Workerallow dumpstate anr_data_file:dir rw_dir_perms; 197*e4a36f41SAndroid Build Coastguard Workerallow dumpstate anr_data_file:file create_file_perms; 198*e4a36f41SAndroid Build Coastguard Worker 199*e4a36f41SAndroid Build Coastguard Worker# Allow reading /data/system/uiderrors.txt 200*e4a36f41SAndroid Build Coastguard Worker# TODO: scope this down. 201*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_data_file:file r_file_perms; 202*e4a36f41SAndroid Build Coastguard Worker 203*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to append into apps' private files. 204*e4a36f41SAndroid Build Coastguard Workerallow dumpstate app_data_file_type:file append; 205*e4a36f41SAndroid Build Coastguard Worker 206*e4a36f41SAndroid Build Coastguard Worker# Read dmesg 207*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability2_class_set syslog; 208*e4a36f41SAndroid Build Coastguard Workerallow dumpstate kernel:system syslog_read; 209*e4a36f41SAndroid Build Coastguard Worker 210*e4a36f41SAndroid Build Coastguard Worker# Read /sys/fs/pstore/console-ramoops 211*e4a36f41SAndroid Build Coastguard Workerallow dumpstate pstorefs:dir r_dir_perms; 212*e4a36f41SAndroid Build Coastguard Workerallow dumpstate pstorefs:file r_file_perms; 213*e4a36f41SAndroid Build Coastguard Worker 214*e4a36f41SAndroid Build Coastguard Worker# Get process attributes 215*e4a36f41SAndroid Build Coastguard Workerallow dumpstate domain:process getattr; 216*e4a36f41SAndroid Build Coastguard Worker 217*e4a36f41SAndroid Build Coastguard Worker# Signal java processes to dump their stack 218*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { appdomain system_server zygote app_zygote }:process signal; 219*e4a36f41SAndroid Build Coastguard Worker 220*e4a36f41SAndroid Build Coastguard Worker# Signal native processes to dump their stack. 221*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 222*e4a36f41SAndroid Build Coastguard Worker # This list comes from native_processes_to_dump in dumputils/dump_utils.c 223*e4a36f41SAndroid Build Coastguard Worker audioserver 224*e4a36f41SAndroid Build Coastguard Worker cameraserver 225*e4a36f41SAndroid Build Coastguard Worker drmserver 226*e4a36f41SAndroid Build Coastguard Worker inputflinger 227*e4a36f41SAndroid Build Coastguard Worker mediadrmserver 228*e4a36f41SAndroid Build Coastguard Worker mediaextractor 229*e4a36f41SAndroid Build Coastguard Worker mediametrics 230*e4a36f41SAndroid Build Coastguard Worker mediaserver 231*e4a36f41SAndroid Build Coastguard Worker mediaswcodec 232*e4a36f41SAndroid Build Coastguard Worker sdcardd 233*e4a36f41SAndroid Build Coastguard Worker surfaceflinger 234*e4a36f41SAndroid Build Coastguard Worker vold 235*e4a36f41SAndroid Build Coastguard Worker 236*e4a36f41SAndroid Build Coastguard Worker # This list comes from hal_interfaces_to_dump in dumputils/dump_utils.c 237*e4a36f41SAndroid Build Coastguard Worker evsmanagerd 238*e4a36f41SAndroid Build Coastguard Worker hal_audio_server 239*e4a36f41SAndroid Build Coastguard Worker hal_audiocontrol_server 240*e4a36f41SAndroid Build Coastguard Worker hal_bluetooth_server 241*e4a36f41SAndroid Build Coastguard Worker hal_broadcastradio_server 242*e4a36f41SAndroid Build Coastguard Worker hal_camera_server 243*e4a36f41SAndroid Build Coastguard Worker hal_codec2_server 244*e4a36f41SAndroid Build Coastguard Worker hal_drm_server 245*e4a36f41SAndroid Build Coastguard Worker hal_evs_server 246*e4a36f41SAndroid Build Coastguard Worker hal_face_server 247*e4a36f41SAndroid Build Coastguard Worker hal_fingerprint_server 248*e4a36f41SAndroid Build Coastguard Worker hal_graphics_allocator_server 249*e4a36f41SAndroid Build Coastguard Worker hal_graphics_composer_server 250*e4a36f41SAndroid Build Coastguard Worker hal_health_server 251*e4a36f41SAndroid Build Coastguard Worker hal_input_processor_server 252*e4a36f41SAndroid Build Coastguard Worker hal_neuralnetworks_server 253*e4a36f41SAndroid Build Coastguard Worker hal_omx_server 254*e4a36f41SAndroid Build Coastguard Worker hal_power_server 255*e4a36f41SAndroid Build Coastguard Worker hal_power_stats_server 256*e4a36f41SAndroid Build Coastguard Worker hal_sensors_server 257*e4a36f41SAndroid Build Coastguard Worker hal_thermal_server 258*e4a36f41SAndroid Build Coastguard Worker hal_vehicle_server 259*e4a36f41SAndroid Build Coastguard Worker hal_vr_server 260*e4a36f41SAndroid Build Coastguard Worker system_suspend_server 261*e4a36f41SAndroid Build Coastguard Worker}:process signal; 262*e4a36f41SAndroid Build Coastguard Worker 263*e4a36f41SAndroid Build Coastguard Worker# On userdebug, dumpstate may fork and execute a command as su. Make sure the 264*e4a36f41SAndroid Build Coastguard Worker# timeout logic is allowed to terminate the child process if necessary. 265*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 266*e4a36f41SAndroid Build Coastguard Worker allow dumpstate su:process { signal sigkill }; 267*e4a36f41SAndroid Build Coastguard Worker') 268*e4a36f41SAndroid Build Coastguard Worker 269*e4a36f41SAndroid Build Coastguard Worker# Connect to tombstoned to intercept dumps. 270*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(dumpstate, tombstoned_intercept, tombstoned) 271*e4a36f41SAndroid Build Coastguard Worker 272*e4a36f41SAndroid Build Coastguard Worker# Access to /sys 273*e4a36f41SAndroid Build Coastguard Workerallow dumpstate sysfs_type:dir r_dir_perms; 274*e4a36f41SAndroid Build Coastguard Worker 275*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 276*e4a36f41SAndroid Build Coastguard Worker sysfs_devices_block 277*e4a36f41SAndroid Build Coastguard Worker sysfs_dm 278*e4a36f41SAndroid Build Coastguard Worker sysfs_loop 279*e4a36f41SAndroid Build Coastguard Worker sysfs_usb 280*e4a36f41SAndroid Build Coastguard Worker sysfs_zram 281*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 282*e4a36f41SAndroid Build Coastguard Worker 283*e4a36f41SAndroid Build Coastguard Worker# Ignore other file access under /sys. 284*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate sysfs:file r_file_perms; 285*e4a36f41SAndroid Build Coastguard Worker 286*e4a36f41SAndroid Build Coastguard Worker# Other random bits of data we want to collect 287*e4a36f41SAndroid Build Coastguard Workerno_debugfs_restriction(` 288*e4a36f41SAndroid Build Coastguard Worker allow dumpstate debugfs:file r_file_perms; 289*e4a36f41SAndroid Build Coastguard Worker auditallow dumpstate debugfs:file r_file_perms; 290*e4a36f41SAndroid Build Coastguard Worker 291*e4a36f41SAndroid Build Coastguard Worker allow dumpstate debugfs_mmc:file r_file_perms; 292*e4a36f41SAndroid Build Coastguard Worker') 293*e4a36f41SAndroid Build Coastguard Worker 294*e4a36f41SAndroid Build Coastguard Worker# df for 295*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 296*e4a36f41SAndroid Build Coastguard Worker block_device 297*e4a36f41SAndroid Build Coastguard Worker cache_file 298*e4a36f41SAndroid Build Coastguard Worker metadata_file 299*e4a36f41SAndroid Build Coastguard Worker rootfs 300*e4a36f41SAndroid Build Coastguard Worker selinuxfs 301*e4a36f41SAndroid Build Coastguard Worker storage_file 302*e4a36f41SAndroid Build Coastguard Worker tmpfs 303*e4a36f41SAndroid Build Coastguard Worker}:dir { search getattr }; 304*e4a36f41SAndroid Build Coastguard Workerallow dumpstate fuse_device:chr_file getattr; 305*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { dm_device cache_block_device }:blk_file getattr; 306*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { cache_file rootfs }:lnk_file { getattr read }; 307*e4a36f41SAndroid Build Coastguard Worker 308*e4a36f41SAndroid Build Coastguard Worker# Read /dev/cpuctl and /dev/cpuset 309*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, cgroup) 310*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, cgroup_v2) 311*e4a36f41SAndroid Build Coastguard Worker 312*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to any binder service 313*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, binderservicedomain) 314*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, { appdomain artd netd wificond }) 315*e4a36f41SAndroid Build Coastguard Worker 316*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to call dump() on specific hals. 317*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_audio) 318*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_audiocontrol) 319*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_authgraph) 320*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_authsecret) 321*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_bluetooth) 322*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_broadcastradio) 323*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_camera) 324*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_codec2) 325*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_contexthub) 326*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_drm) 327*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_dumpstate) 328*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_evs) 329*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_face) 330*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_fingerprint) 331*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_gnss) 332*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_graphics_allocator) 333*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_graphics_composer) 334*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_health) 335*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_identity) 336*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_input_processor) 337*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_keymint) 338*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_light) 339*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_memtrack) 340*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_neuralnetworks) 341*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_nfc) 342*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_oemlock) 343*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_power) 344*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_power_stats) 345*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_rebootescrow) 346*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_secretkeeper) 347*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_sensors) 348*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_thermal) 349*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_vehicle) 350*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_weaver) 351*e4a36f41SAndroid Build Coastguard Workerdump_hal(hal_wifi) 352*e4a36f41SAndroid Build Coastguard Worker 353*e4a36f41SAndroid Build Coastguard Worker# Vibrate the device after we are done collecting the bugreport 354*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(dumpstate, hal_vibrator) 355*e4a36f41SAndroid Build Coastguard Worker 356*e4a36f41SAndroid Build Coastguard Worker# Reading /proc/PID/maps of other processes 357*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set sys_ptrace; 358*e4a36f41SAndroid Build Coastguard Worker 359*e4a36f41SAndroid Build Coastguard Worker# Allow the bugreport service to create a file in 360*e4a36f41SAndroid Build Coastguard Worker# /data/data/com.android.shell/files/bugreports/bugreport 361*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_data_file:dir create_dir_perms; 362*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_data_file:file create_file_perms; 363*e4a36f41SAndroid Build Coastguard Worker 364*e4a36f41SAndroid Build Coastguard Worker# Run a shell. 365*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_exec:file rx_file_perms; 366*e4a36f41SAndroid Build Coastguard Worker 367*e4a36f41SAndroid Build Coastguard Worker# For running am and similar framework commands. 368*e4a36f41SAndroid Build Coastguard Worker# Run /system/bin/app_process. 369*e4a36f41SAndroid Build Coastguard Workerallow dumpstate zygote_exec:file rx_file_perms; 370*e4a36f41SAndroid Build Coastguard Worker 371*e4a36f41SAndroid Build Coastguard Worker# For Bluetooth 372*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_data_file:dir search; 373*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_logs_data_file:dir r_dir_perms; 374*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_logs_data_file:file r_file_perms; 375*e4a36f41SAndroid Build Coastguard Worker 376*e4a36f41SAndroid Build Coastguard Worker# For Nfc 377*e4a36f41SAndroid Build Coastguard Workerallow dumpstate nfc_logs_data_file:dir r_dir_perms; 378*e4a36f41SAndroid Build Coastguard Workerallow dumpstate nfc_logs_data_file:file r_file_perms; 379*e4a36f41SAndroid Build Coastguard Worker 380*e4a36f41SAndroid Build Coastguard Worker# For uwb 381*e4a36f41SAndroid Build Coastguard Workerallow dumpstate apex_module_data_file:dir search; 382*e4a36f41SAndroid Build Coastguard Workerallow dumpstate apex_system_server_data_file:dir search; 383*e4a36f41SAndroid Build Coastguard Workerallow dumpstate apex_uwb_data_file:dir r_dir_perms; 384*e4a36f41SAndroid Build Coastguard Workerallow dumpstate apex_uwb_data_file:file r_file_perms; 385*e4a36f41SAndroid Build Coastguard Worker 386*e4a36f41SAndroid Build Coastguard Worker# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access 387*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gpu_device:chr_file rw_file_perms; 388*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gpu_device:dir r_dir_perms; 389*e4a36f41SAndroid Build Coastguard Worker 390*e4a36f41SAndroid Build Coastguard Worker# logd access 391*e4a36f41SAndroid Build Coastguard Workerread_logd(dumpstate) 392*e4a36f41SAndroid Build Coastguard Workercontrol_logd(dumpstate) 393*e4a36f41SAndroid Build Coastguard Workerread_runtime_log_tags(dumpstate) 394*e4a36f41SAndroid Build Coastguard Worker 395*e4a36f41SAndroid Build Coastguard Worker# Read files in /proc 396*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 397*e4a36f41SAndroid Build Coastguard Worker proc_bootconfig 398*e4a36f41SAndroid Build Coastguard Worker proc_buddyinfo 399*e4a36f41SAndroid Build Coastguard Worker proc_cmdline 400*e4a36f41SAndroid Build Coastguard Worker proc_meminfo 401*e4a36f41SAndroid Build Coastguard Worker proc_modules 402*e4a36f41SAndroid Build Coastguard Worker proc_net_type 403*e4a36f41SAndroid Build Coastguard Worker proc_pipe_conf 404*e4a36f41SAndroid Build Coastguard Worker proc_pagetypeinfo 405*e4a36f41SAndroid Build Coastguard Worker proc_qtaguid_ctrl 406*e4a36f41SAndroid Build Coastguard Worker proc_qtaguid_stat 407*e4a36f41SAndroid Build Coastguard Worker proc_slabinfo 408*e4a36f41SAndroid Build Coastguard Worker proc_version 409*e4a36f41SAndroid Build Coastguard Worker proc_vmallocinfo 410*e4a36f41SAndroid Build Coastguard Worker proc_vmstat 411*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 412*e4a36f41SAndroid Build Coastguard Worker 413*e4a36f41SAndroid Build Coastguard Worker# Read network state info files. 414*e4a36f41SAndroid Build Coastguard Workerallow dumpstate net_data_file:dir search; 415*e4a36f41SAndroid Build Coastguard Workerallow dumpstate net_data_file:file r_file_perms; 416*e4a36f41SAndroid Build Coastguard Worker 417*e4a36f41SAndroid Build Coastguard Worker# List sockets via ss. 418*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_tcpdiag_socket { create_socket_perms_no_ioctl nlmsg_read }; 419*e4a36f41SAndroid Build Coastguard Worker 420*e4a36f41SAndroid Build Coastguard Worker# Access /data/tombstones. 421*e4a36f41SAndroid Build Coastguard Workerallow dumpstate tombstone_data_file:dir r_dir_perms; 422*e4a36f41SAndroid Build Coastguard Workerallow dumpstate tombstone_data_file:file r_file_perms; 423*e4a36f41SAndroid Build Coastguard Worker 424*e4a36f41SAndroid Build Coastguard Worker# Access /cache/recovery 425*e4a36f41SAndroid Build Coastguard Workerallow dumpstate cache_recovery_file:dir r_dir_perms; 426*e4a36f41SAndroid Build Coastguard Workerallow dumpstate cache_recovery_file:file r_file_perms; 427*e4a36f41SAndroid Build Coastguard Worker 428*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/recovery 429*e4a36f41SAndroid Build Coastguard Workerallow dumpstate recovery_data_file:dir r_dir_perms; 430*e4a36f41SAndroid Build Coastguard Workerallow dumpstate recovery_data_file:file r_file_perms; 431*e4a36f41SAndroid Build Coastguard Worker 432*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/update_engine & /data/misc/update_engine_log 433*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { update_engine_data_file update_engine_log_data_file }:dir r_dir_perms; 434*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { update_engine_data_file update_engine_log_data_file }:file r_file_perms; 435*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/snapuserd_log 436*e4a36f41SAndroid Build Coastguard Workerallow dumpstate snapuserd_log_data_file:dir r_dir_perms; 437*e4a36f41SAndroid Build Coastguard Workerallow dumpstate snapuserd_log_data_file:file r_file_perms; 438*e4a36f41SAndroid Build Coastguard Worker 439*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/profiles/{cur,ref}/ 440*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 441*e4a36f41SAndroid Build Coastguard Worker allow dumpstate { user_profile_root_file user_profile_data_file}:dir r_dir_perms; 442*e4a36f41SAndroid Build Coastguard Worker allow dumpstate user_profile_data_file:file r_file_perms; 443*e4a36f41SAndroid Build Coastguard Worker') 444*e4a36f41SAndroid Build Coastguard Worker 445*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/logd 446*e4a36f41SAndroid Build Coastguard Workerallow dumpstate misc_logd_file:dir r_dir_perms; 447*e4a36f41SAndroid Build Coastguard Workerallow dumpstate misc_logd_file:file r_file_perms; 448*e4a36f41SAndroid Build Coastguard Worker 449*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/prereboot 450*e4a36f41SAndroid Build Coastguard Workerallow dumpstate prereboot_data_file:dir r_dir_perms; 451*e4a36f41SAndroid Build Coastguard Workerallow dumpstate prereboot_data_file:file r_file_perms; 452*e4a36f41SAndroid Build Coastguard Worker 453*e4a36f41SAndroid Build Coastguard Workerallow dumpstate app_fuse_file:dir r_dir_perms; 454*e4a36f41SAndroid Build Coastguard Workerallow dumpstate overlayfs_file:dir r_dir_perms; 455*e4a36f41SAndroid Build Coastguard Worker 456*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 457*e4a36f41SAndroid Build Coastguard Worker service_manager_type 458*e4a36f41SAndroid Build Coastguard Worker -apex_service 459*e4a36f41SAndroid Build Coastguard Worker -dumpstate_service 460*e4a36f41SAndroid Build Coastguard Worker -gatekeeper_service 461*e4a36f41SAndroid Build Coastguard Worker -hal_service_type 462*e4a36f41SAndroid Build Coastguard Worker -virtual_touchpad_service 463*e4a36f41SAndroid Build Coastguard Worker -vold_service 464*e4a36f41SAndroid Build Coastguard Worker -default_android_service 465*e4a36f41SAndroid Build Coastguard Worker}:service_manager find; 466*e4a36f41SAndroid Build Coastguard Worker# suppress denials for services dumpstate should not be accessing. 467*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate { 468*e4a36f41SAndroid Build Coastguard Worker apex_service 469*e4a36f41SAndroid Build Coastguard Worker dumpstate_service 470*e4a36f41SAndroid Build Coastguard Worker gatekeeper_service 471*e4a36f41SAndroid Build Coastguard Worker hal_service_type 472*e4a36f41SAndroid Build Coastguard Worker virtual_touchpad_service 473*e4a36f41SAndroid Build Coastguard Worker vold_service 474*e4a36f41SAndroid Build Coastguard Worker}:service_manager find; 475*e4a36f41SAndroid Build Coastguard Worker 476*e4a36f41SAndroid Build Coastguard Worker# Most of these are neverallowed. 477*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate hwservice_manager_type:hwservice_manager find; 478*e4a36f41SAndroid Build Coastguard Worker 479*e4a36f41SAndroid Build Coastguard Workerallow dumpstate servicemanager:service_manager list; 480*e4a36f41SAndroid Build Coastguard Workerallow dumpstate hwservicemanager:hwservice_manager list; 481*e4a36f41SAndroid Build Coastguard Worker 482*e4a36f41SAndroid Build Coastguard Workerallow dumpstate devpts:chr_file rw_file_perms; 483*e4a36f41SAndroid Build Coastguard Worker 484*e4a36f41SAndroid Build Coastguard Worker# Read any system properties 485*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, property_type) 486*e4a36f41SAndroid Build Coastguard Worker 487*e4a36f41SAndroid Build Coastguard Worker# Access to /data/media. 488*e4a36f41SAndroid Build Coastguard Worker# This should be removed if sdcardfs is modified to alter the secontext for its 489*e4a36f41SAndroid Build Coastguard Worker# accesses to the underlying FS. 490*e4a36f41SAndroid Build Coastguard Workerallow dumpstate media_rw_data_file:dir getattr; 491*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_interrupts:file r_file_perms; 492*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_zoneinfo:file r_file_perms; 493*e4a36f41SAndroid Build Coastguard Worker 494*e4a36f41SAndroid Build Coastguard Worker# Create a service for talking back to system_server 495*e4a36f41SAndroid Build Coastguard Workeradd_service(dumpstate, dumpstate_service) 496*e4a36f41SAndroid Build Coastguard Worker 497*e4a36f41SAndroid Build Coastguard Worker# use /dev/ion for screen capture 498*e4a36f41SAndroid Build Coastguard Workerallow dumpstate ion_device:chr_file r_file_perms; 499*e4a36f41SAndroid Build Coastguard Worker 500*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run top 501*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_stat:file r_file_perms; 502*e4a36f41SAndroid Build Coastguard Worker 503*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_pressure_cpu:file r_file_perms; 504*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_pressure_mem:file r_file_perms; 505*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_pressure_io:file r_file_perms; 506*e4a36f41SAndroid Build Coastguard Worker 507*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run ps 508*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_pid_max:file r_file_perms; 509*e4a36f41SAndroid Build Coastguard Worker 510*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to installd over binder 511*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, installd); 512*e4a36f41SAndroid Build Coastguard Worker 513*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run ip xfrm policy 514*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_xfrm_socket { create_socket_perms_no_ioctl nlmsg_read }; 515*e4a36f41SAndroid Build Coastguard Worker 516*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run iotop 517*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_socket create_socket_perms_no_ioctl; 518*e4a36f41SAndroid Build Coastguard Worker# newer kernels (e.g. 4.4) have a new class for sockets 519*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_generic_socket create_socket_perms_no_ioctl; 520*e4a36f41SAndroid Build Coastguard Worker 521*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run ss 522*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { domain pdx_channel_socket_type pdx_endpoint_socket_type }:socket_class_set getattr; 523*e4a36f41SAndroid Build Coastguard Worker 524*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to read linkerconfig directory 525*e4a36f41SAndroid Build Coastguard Workerallow dumpstate linkerconfig_file:dir { read open }; 526*e4a36f41SAndroid Build Coastguard Worker 527*e4a36f41SAndroid Build Coastguard Worker# For when dumpstate runs df 528*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate { 529*e4a36f41SAndroid Build Coastguard Worker mnt_vendor_file 530*e4a36f41SAndroid Build Coastguard Worker mirror_data_file 531*e4a36f41SAndroid Build Coastguard Worker mnt_user_file 532*e4a36f41SAndroid Build Coastguard Worker mnt_product_file 533*e4a36f41SAndroid Build Coastguard Worker}:dir search; 534*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate { 535*e4a36f41SAndroid Build Coastguard Worker apex_mnt_dir 536*e4a36f41SAndroid Build Coastguard Worker linkerconfig_file 537*e4a36f41SAndroid Build Coastguard Worker mirror_data_file 538*e4a36f41SAndroid Build Coastguard Worker mnt_user_file 539*e4a36f41SAndroid Build Coastguard Worker vm_data_file 540*e4a36f41SAndroid Build Coastguard Worker}:dir getattr; 541*e4a36f41SAndroid Build Coastguard Worker 542*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to bufferhubd over binder 543*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, bufferhubd); 544*e4a36f41SAndroid Build Coastguard Worker 545*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to mediaswcodec over binder 546*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, mediaswcodec); 547*e4a36f41SAndroid Build Coastguard Worker 548*e4a36f41SAndroid Build Coastguard Worker#Access /data/misc/snapshotctl_log 549*e4a36f41SAndroid Build Coastguard Workerallow dumpstate snapshotctl_log_data_file:dir r_dir_perms; 550*e4a36f41SAndroid Build Coastguard Workerallow dumpstate snapshotctl_log_data_file:file r_file_perms; 551*e4a36f41SAndroid Build Coastguard Worker 552*e4a36f41SAndroid Build Coastguard Worker#Allow access to /dev/binderfs/binder_logs 553*e4a36f41SAndroid Build Coastguard Workerallow dumpstate binderfs_logs:dir r_dir_perms; 554*e4a36f41SAndroid Build Coastguard Workerallow dumpstate binderfs_logs:file r_file_perms; 555*e4a36f41SAndroid Build Coastguard Workerallow dumpstate binderfs_logs_proc:file r_file_perms; 556*e4a36f41SAndroid Build Coastguard Workerallow dumpstate binderfs_logs_stats:file r_file_perms; 557*e4a36f41SAndroid Build Coastguard Worker 558*e4a36f41SAndroid Build Coastguard Workeruse_apex_info(dumpstate) 559*e4a36f41SAndroid Build Coastguard Worker 560*e4a36f41SAndroid Build Coastguard Worker# Allow reading files under /data/system/shutdown-checkpoints/ 561*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shutdown_checkpoints_system_data_file:dir r_dir_perms; 562*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shutdown_checkpoints_system_data_file:file r_file_perms; 563*e4a36f41SAndroid Build Coastguard Worker 564*e4a36f41SAndroid Build Coastguard Worker### 565*e4a36f41SAndroid Build Coastguard Worker### neverallow rules 566*e4a36f41SAndroid Build Coastguard Worker### 567*e4a36f41SAndroid Build Coastguard Worker 568*e4a36f41SAndroid Build Coastguard Worker# dumpstate has capability sys_ptrace, but should only use that capability for 569*e4a36f41SAndroid Build Coastguard Worker# accessing sensitive /proc/PID files, never for using ptrace attach. 570*e4a36f41SAndroid Build Coastguard Workerneverallow dumpstate *:process ptrace; 571*e4a36f41SAndroid Build Coastguard Worker 572*e4a36f41SAndroid Build Coastguard Worker# only system_server, dumpstate, traceur_app and shell can find the dumpstate service 573*e4a36f41SAndroid Build Coastguard Workerneverallow { 574*e4a36f41SAndroid Build Coastguard Worker domain 575*e4a36f41SAndroid Build Coastguard Worker -system_server 576*e4a36f41SAndroid Build Coastguard Worker -shell 577*e4a36f41SAndroid Build Coastguard Worker -traceur_app 578*e4a36f41SAndroid Build Coastguard Worker -dumpstate 579*e4a36f41SAndroid Build Coastguard Worker} dumpstate_service:service_manager find; 580*e4a36f41SAndroid Build Coastguard Worker 581*e4a36f41SAndroid Build Coastguard Worker# only dumpstate, system_server and related others to access apex_uwb_data_file 582*e4a36f41SAndroid Build Coastguard Workerneverallow { 583*e4a36f41SAndroid Build Coastguard Worker domain 584*e4a36f41SAndroid Build Coastguard Worker -dumpstate 585*e4a36f41SAndroid Build Coastguard Worker -system_server 586*e4a36f41SAndroid Build Coastguard Worker -apexd 587*e4a36f41SAndroid Build Coastguard Worker -init 588*e4a36f41SAndroid Build Coastguard Worker -vold_prepare_subdirs 589*e4a36f41SAndroid Build Coastguard Worker} apex_uwb_data_file:dir no_rw_file_perms; 590*e4a36f41SAndroid Build Coastguard Workerneverallow { 591*e4a36f41SAndroid Build Coastguard Worker domain 592*e4a36f41SAndroid Build Coastguard Worker -dumpstate 593*e4a36f41SAndroid Build Coastguard Worker -system_server 594*e4a36f41SAndroid Build Coastguard Worker -apexd 595*e4a36f41SAndroid Build Coastguard Worker -init 596*e4a36f41SAndroid Build Coastguard Worker -vold_prepare_subdirs 597*e4a36f41SAndroid Build Coastguard Worker} apex_uwb_data_file:file no_rw_file_perms; 598