1*e4a36f41SAndroid Build Coastguard Worker# dumpstate 2*e4a36f41SAndroid Build Coastguard Workertype dumpstate, domain, mlstrustedsubject; 3*e4a36f41SAndroid Build Coastguard Workertype dumpstate_exec, system_file_type, exec_type, file_type; 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Workernet_domain(dumpstate) 6*e4a36f41SAndroid Build Coastguard Workerbinder_use(dumpstate) 7*e4a36f41SAndroid Build Coastguard Workerwakelock_use(dumpstate) 8*e4a36f41SAndroid Build Coastguard Worker 9*e4a36f41SAndroid Build Coastguard Worker# Allow setting process priority, protect from OOM killer, and dropping 10*e4a36f41SAndroid Build Coastguard Worker# privileges by switching UID / GID 11*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { setuid setgid sys_resource }; 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to scan through /proc/pid for all processes 14*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, domain) 15*e4a36f41SAndroid Build Coastguard Worker 16*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { 17*e4a36f41SAndroid Build Coastguard Worker # Send signals to processes 18*e4a36f41SAndroid Build Coastguard Worker kill 19*e4a36f41SAndroid Build Coastguard Worker # Run iptables 20*e4a36f41SAndroid Build Coastguard Worker net_raw 21*e4a36f41SAndroid Build Coastguard Worker net_admin 22*e4a36f41SAndroid Build Coastguard Worker}; 23*e4a36f41SAndroid Build Coastguard Worker 24*e4a36f41SAndroid Build Coastguard Worker# Allow executing files on system, such as: 25*e4a36f41SAndroid Build Coastguard Worker# /system/bin/toolbox 26*e4a36f41SAndroid Build Coastguard Worker# /system/bin/logcat 27*e4a36f41SAndroid Build Coastguard Worker# /system/bin/dumpsys 28*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_file:file execute_no_trans; 29*e4a36f41SAndroid Build Coastguard Workernot_full_treble(`allow dumpstate vendor_file:file execute_no_trans;') 30*e4a36f41SAndroid Build Coastguard Workerallow dumpstate toolbox_exec:file rx_file_perms; 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Worker# hidl searches for files in /system/lib(64)/hw/ 33*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_file:dir r_dir_perms; 34*e4a36f41SAndroid Build Coastguard Worker 35*e4a36f41SAndroid Build Coastguard Worker# Create and write into /data/anr/ 36*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set { dac_override dac_read_search chown fowner fsetid }; 37*e4a36f41SAndroid Build Coastguard Workerallow dumpstate anr_data_file:dir rw_dir_perms; 38*e4a36f41SAndroid Build Coastguard Workerallow dumpstate anr_data_file:file create_file_perms; 39*e4a36f41SAndroid Build Coastguard Worker 40*e4a36f41SAndroid Build Coastguard Worker# Allow reading /data/system/uiderrors.txt 41*e4a36f41SAndroid Build Coastguard Worker# TODO: scope this down. 42*e4a36f41SAndroid Build Coastguard Workerallow dumpstate system_data_file:file r_file_perms; 43*e4a36f41SAndroid Build Coastguard Worker 44*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to append into privileged apps private files. 45*e4a36f41SAndroid Build Coastguard Workerallow dumpstate privapp_data_file:file append; 46*e4a36f41SAndroid Build Coastguard Worker 47*e4a36f41SAndroid Build Coastguard Worker# Read dmesg 48*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability2_class_set syslog; 49*e4a36f41SAndroid Build Coastguard Workerallow dumpstate kernel:system syslog_read; 50*e4a36f41SAndroid Build Coastguard Worker 51*e4a36f41SAndroid Build Coastguard Worker# Read /sys/fs/pstore/console-ramoops 52*e4a36f41SAndroid Build Coastguard Workerallow dumpstate pstorefs:dir r_dir_perms; 53*e4a36f41SAndroid Build Coastguard Workerallow dumpstate pstorefs:file r_file_perms; 54*e4a36f41SAndroid Build Coastguard Worker 55*e4a36f41SAndroid Build Coastguard Worker# Get process attributes 56*e4a36f41SAndroid Build Coastguard Workerallow dumpstate domain:process getattr; 57*e4a36f41SAndroid Build Coastguard Worker 58*e4a36f41SAndroid Build Coastguard Worker# Signal java processes to dump their stack 59*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { appdomain system_server zygote }:process signal; 60*e4a36f41SAndroid Build Coastguard Worker 61*e4a36f41SAndroid Build Coastguard Worker# Signal native processes to dump their stack. 62*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 63*e4a36f41SAndroid Build Coastguard Worker # This list comes from native_processes_to_dump in dumputils/dump_utils.c 64*e4a36f41SAndroid Build Coastguard Worker audioserver 65*e4a36f41SAndroid Build Coastguard Worker cameraserver 66*e4a36f41SAndroid Build Coastguard Worker drmserver 67*e4a36f41SAndroid Build Coastguard Worker inputflinger 68*e4a36f41SAndroid Build Coastguard Worker mediadrmserver 69*e4a36f41SAndroid Build Coastguard Worker mediaextractor 70*e4a36f41SAndroid Build Coastguard Worker mediametrics 71*e4a36f41SAndroid Build Coastguard Worker mediaserver 72*e4a36f41SAndroid Build Coastguard Worker mediaswcodec 73*e4a36f41SAndroid Build Coastguard Worker sdcardd 74*e4a36f41SAndroid Build Coastguard Worker surfaceflinger 75*e4a36f41SAndroid Build Coastguard Worker vold 76*e4a36f41SAndroid Build Coastguard Worker 77*e4a36f41SAndroid Build Coastguard Worker # This list comes from hal_interfaces_to_dump in dumputils/dump_utils.c 78*e4a36f41SAndroid Build Coastguard Worker hal_audio_server 79*e4a36f41SAndroid Build Coastguard Worker hal_bluetooth_server 80*e4a36f41SAndroid Build Coastguard Worker hal_camera_server 81*e4a36f41SAndroid Build Coastguard Worker hal_codec2_server 82*e4a36f41SAndroid Build Coastguard Worker hal_drm_server 83*e4a36f41SAndroid Build Coastguard Worker hal_face_server 84*e4a36f41SAndroid Build Coastguard Worker hal_graphics_allocator_server 85*e4a36f41SAndroid Build Coastguard Worker hal_graphics_composer_server 86*e4a36f41SAndroid Build Coastguard Worker hal_health_server 87*e4a36f41SAndroid Build Coastguard Worker hal_omx_server 88*e4a36f41SAndroid Build Coastguard Worker hal_power_server 89*e4a36f41SAndroid Build Coastguard Worker hal_power_stats_server 90*e4a36f41SAndroid Build Coastguard Worker hal_sensors_server 91*e4a36f41SAndroid Build Coastguard Worker hal_thermal_server 92*e4a36f41SAndroid Build Coastguard Worker hal_vr_server 93*e4a36f41SAndroid Build Coastguard Worker}:process signal; 94*e4a36f41SAndroid Build Coastguard Worker 95*e4a36f41SAndroid Build Coastguard Worker# Connect to tombstoned to intercept dumps. 96*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(dumpstate, tombstoned_intercept, tombstoned) 97*e4a36f41SAndroid Build Coastguard Worker 98*e4a36f41SAndroid Build Coastguard Worker# Access to /sys 99*e4a36f41SAndroid Build Coastguard Workerallow dumpstate sysfs_type:dir r_dir_perms; 100*e4a36f41SAndroid Build Coastguard Worker 101*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 102*e4a36f41SAndroid Build Coastguard Worker sysfs_devices_block 103*e4a36f41SAndroid Build Coastguard Worker sysfs_dm 104*e4a36f41SAndroid Build Coastguard Worker sysfs_loop 105*e4a36f41SAndroid Build Coastguard Worker sysfs_usb 106*e4a36f41SAndroid Build Coastguard Worker sysfs_zram 107*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 108*e4a36f41SAndroid Build Coastguard Worker 109*e4a36f41SAndroid Build Coastguard Worker# Other random bits of data we want to collect 110*e4a36f41SAndroid Build Coastguard Workerallow dumpstate debugfs:file r_file_perms; 111*e4a36f41SAndroid Build Coastguard Workerauditallow dumpstate debugfs:file r_file_perms; 112*e4a36f41SAndroid Build Coastguard Worker 113*e4a36f41SAndroid Build Coastguard Workerallow dumpstate debugfs_mmc:file r_file_perms; 114*e4a36f41SAndroid Build Coastguard Worker 115*e4a36f41SAndroid Build Coastguard Worker# df for 116*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 117*e4a36f41SAndroid Build Coastguard Worker block_device 118*e4a36f41SAndroid Build Coastguard Worker cache_file 119*e4a36f41SAndroid Build Coastguard Worker metadata_file 120*e4a36f41SAndroid Build Coastguard Worker rootfs 121*e4a36f41SAndroid Build Coastguard Worker selinuxfs 122*e4a36f41SAndroid Build Coastguard Worker storage_file 123*e4a36f41SAndroid Build Coastguard Worker tmpfs 124*e4a36f41SAndroid Build Coastguard Worker}:dir { search getattr }; 125*e4a36f41SAndroid Build Coastguard Workerallow dumpstate fuse_device:chr_file getattr; 126*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { dm_device cache_block_device }:blk_file getattr; 127*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { cache_file rootfs }:lnk_file { getattr read }; 128*e4a36f41SAndroid Build Coastguard Worker 129*e4a36f41SAndroid Build Coastguard Worker# Read /dev/cpuctl and /dev/cpuset 130*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dumpstate, cgroup) 131*e4a36f41SAndroid Build Coastguard Worker 132*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to make binder calls to any binder service 133*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, binderservicedomain) 134*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, { appdomain netd wificond }) 135*e4a36f41SAndroid Build Coastguard Worker 136*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(dumpstate, hal_dumpstate) 137*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(dumpstate, hal_wifi) 138*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(dumpstate, hal_graphics_allocator) 139*e4a36f41SAndroid Build Coastguard Worker# Vibrate the device after we are done collecting the bugreport 140*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(dumpstate, hal_vibrator) 141*e4a36f41SAndroid Build Coastguard Worker 142*e4a36f41SAndroid Build Coastguard Worker# Reading /proc/PID/maps of other processes 143*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:global_capability_class_set sys_ptrace; 144*e4a36f41SAndroid Build Coastguard Worker 145*e4a36f41SAndroid Build Coastguard Worker# Allow the bugreport service to create a file in 146*e4a36f41SAndroid Build Coastguard Worker# /data/data/com.android.shell/files/bugreports/bugreport 147*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_data_file:dir create_dir_perms; 148*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_data_file:file create_file_perms; 149*e4a36f41SAndroid Build Coastguard Worker 150*e4a36f41SAndroid Build Coastguard Worker# Run a shell. 151*e4a36f41SAndroid Build Coastguard Workerallow dumpstate shell_exec:file rx_file_perms; 152*e4a36f41SAndroid Build Coastguard Worker 153*e4a36f41SAndroid Build Coastguard Worker# For running am and similar framework commands. 154*e4a36f41SAndroid Build Coastguard Worker# Run /system/bin/app_process. 155*e4a36f41SAndroid Build Coastguard Workerallow dumpstate zygote_exec:file rx_file_perms; 156*e4a36f41SAndroid Build Coastguard Worker 157*e4a36f41SAndroid Build Coastguard Worker# For Bluetooth 158*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_data_file:dir search; 159*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_logs_data_file:dir r_dir_perms; 160*e4a36f41SAndroid Build Coastguard Workerallow dumpstate bluetooth_logs_data_file:file r_file_perms; 161*e4a36f41SAndroid Build Coastguard Worker 162*e4a36f41SAndroid Build Coastguard Worker# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access 163*e4a36f41SAndroid Build Coastguard Workerallow dumpstate gpu_device:chr_file rw_file_perms; 164*e4a36f41SAndroid Build Coastguard Worker 165*e4a36f41SAndroid Build Coastguard Worker# logd access 166*e4a36f41SAndroid Build Coastguard Workerread_logd(dumpstate) 167*e4a36f41SAndroid Build Coastguard Workercontrol_logd(dumpstate) 168*e4a36f41SAndroid Build Coastguard Workerread_runtime_log_tags(dumpstate) 169*e4a36f41SAndroid Build Coastguard Worker 170*e4a36f41SAndroid Build Coastguard Worker# Read files in /proc 171*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 172*e4a36f41SAndroid Build Coastguard Worker proc_buddyinfo 173*e4a36f41SAndroid Build Coastguard Worker proc_cmdline 174*e4a36f41SAndroid Build Coastguard Worker proc_meminfo 175*e4a36f41SAndroid Build Coastguard Worker proc_modules 176*e4a36f41SAndroid Build Coastguard Worker proc_net_type 177*e4a36f41SAndroid Build Coastguard Worker proc_pipe_conf 178*e4a36f41SAndroid Build Coastguard Worker proc_pagetypeinfo 179*e4a36f41SAndroid Build Coastguard Worker proc_qtaguid_ctrl 180*e4a36f41SAndroid Build Coastguard Worker proc_qtaguid_stat 181*e4a36f41SAndroid Build Coastguard Worker proc_slabinfo 182*e4a36f41SAndroid Build Coastguard Worker proc_version 183*e4a36f41SAndroid Build Coastguard Worker proc_vmallocinfo 184*e4a36f41SAndroid Build Coastguard Worker proc_vmstat 185*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 186*e4a36f41SAndroid Build Coastguard Worker 187*e4a36f41SAndroid Build Coastguard Worker# Read network state info files. 188*e4a36f41SAndroid Build Coastguard Workerallow dumpstate net_data_file:dir search; 189*e4a36f41SAndroid Build Coastguard Workerallow dumpstate net_data_file:file r_file_perms; 190*e4a36f41SAndroid Build Coastguard Worker 191*e4a36f41SAndroid Build Coastguard Worker# List sockets via ss. 192*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_tcpdiag_socket { create_socket_perms_no_ioctl nlmsg_read }; 193*e4a36f41SAndroid Build Coastguard Worker 194*e4a36f41SAndroid Build Coastguard Worker# Access /data/tombstones. 195*e4a36f41SAndroid Build Coastguard Workerallow dumpstate tombstone_data_file:dir r_dir_perms; 196*e4a36f41SAndroid Build Coastguard Workerallow dumpstate tombstone_data_file:file r_file_perms; 197*e4a36f41SAndroid Build Coastguard Worker 198*e4a36f41SAndroid Build Coastguard Worker# Access /cache/recovery 199*e4a36f41SAndroid Build Coastguard Workerallow dumpstate cache_recovery_file:dir r_dir_perms; 200*e4a36f41SAndroid Build Coastguard Workerallow dumpstate cache_recovery_file:file r_file_perms; 201*e4a36f41SAndroid Build Coastguard Worker 202*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/recovery 203*e4a36f41SAndroid Build Coastguard Workerallow dumpstate recovery_data_file:dir r_dir_perms; 204*e4a36f41SAndroid Build Coastguard Workerallow dumpstate recovery_data_file:file r_file_perms; 205*e4a36f41SAndroid Build Coastguard Worker 206*e4a36f41SAndroid Build Coastguard Worker#Access /data/misc/update_engine_log 207*e4a36f41SAndroid Build Coastguard Workerallow dumpstate update_engine_log_data_file:dir r_dir_perms; 208*e4a36f41SAndroid Build Coastguard Workerallow dumpstate update_engine_log_data_file:file r_file_perms; 209*e4a36f41SAndroid Build Coastguard Worker 210*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/profiles/{cur,ref}/ 211*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 212*e4a36f41SAndroid Build Coastguard Worker allow dumpstate user_profile_data_file:dir r_dir_perms; 213*e4a36f41SAndroid Build Coastguard Worker allow dumpstate user_profile_data_file:file r_file_perms; 214*e4a36f41SAndroid Build Coastguard Worker') 215*e4a36f41SAndroid Build Coastguard Worker 216*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/logd 217*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 218*e4a36f41SAndroid Build Coastguard Worker allow dumpstate misc_logd_file:dir r_dir_perms; 219*e4a36f41SAndroid Build Coastguard Worker allow dumpstate misc_logd_file:file r_file_perms; 220*e4a36f41SAndroid Build Coastguard Worker') 221*e4a36f41SAndroid Build Coastguard Worker 222*e4a36f41SAndroid Build Coastguard Workerallow dumpstate app_fuse_file:dir r_dir_perms; 223*e4a36f41SAndroid Build Coastguard Workerallow dumpstate overlayfs_file:dir r_dir_perms; 224*e4a36f41SAndroid Build Coastguard Worker 225*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { 226*e4a36f41SAndroid Build Coastguard Worker service_manager_type 227*e4a36f41SAndroid Build Coastguard Worker -apex_service 228*e4a36f41SAndroid Build Coastguard Worker -dumpstate_service 229*e4a36f41SAndroid Build Coastguard Worker -gatekeeper_service 230*e4a36f41SAndroid Build Coastguard Worker -iorapd_service 231*e4a36f41SAndroid Build Coastguard Worker -virtual_touchpad_service 232*e4a36f41SAndroid Build Coastguard Worker -vold_service 233*e4a36f41SAndroid Build Coastguard Worker -vr_hwc_service 234*e4a36f41SAndroid Build Coastguard Worker}:service_manager find; 235*e4a36f41SAndroid Build Coastguard Worker# suppress denials for services dumpstate should not be accessing. 236*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate { 237*e4a36f41SAndroid Build Coastguard Worker apex_service 238*e4a36f41SAndroid Build Coastguard Worker dumpstate_service 239*e4a36f41SAndroid Build Coastguard Worker gatekeeper_service 240*e4a36f41SAndroid Build Coastguard Worker iorapd_service 241*e4a36f41SAndroid Build Coastguard Worker virtual_touchpad_service 242*e4a36f41SAndroid Build Coastguard Worker vold_service 243*e4a36f41SAndroid Build Coastguard Worker vr_hwc_service 244*e4a36f41SAndroid Build Coastguard Worker}:service_manager find; 245*e4a36f41SAndroid Build Coastguard Worker 246*e4a36f41SAndroid Build Coastguard Worker# Most of these are neverallowed. 247*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate hwservice_manager_type:hwservice_manager find; 248*e4a36f41SAndroid Build Coastguard Worker 249*e4a36f41SAndroid Build Coastguard Workerallow dumpstate servicemanager:service_manager list; 250*e4a36f41SAndroid Build Coastguard Workerallow dumpstate hwservicemanager:hwservice_manager list; 251*e4a36f41SAndroid Build Coastguard Worker 252*e4a36f41SAndroid Build Coastguard Workerallow dumpstate devpts:chr_file rw_file_perms; 253*e4a36f41SAndroid Build Coastguard Worker 254*e4a36f41SAndroid Build Coastguard Worker# Set properties. 255*e4a36f41SAndroid Build Coastguard Worker# dumpstate_prop is used to share state with the Shell app. 256*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_prop) 257*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, exported_dumpstate_prop) 258*e4a36f41SAndroid Build Coastguard Worker# dumpstate_options_prop is used to pass extra command-line args. 259*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, dumpstate_options_prop) 260*e4a36f41SAndroid Build Coastguard Worker 261*e4a36f41SAndroid Build Coastguard Worker# Read any system properties 262*e4a36f41SAndroid Build Coastguard Workerget_prop(dumpstate, property_type) 263*e4a36f41SAndroid Build Coastguard Worker 264*e4a36f41SAndroid Build Coastguard Worker# Access to /data/media. 265*e4a36f41SAndroid Build Coastguard Worker# This should be removed if sdcardfs is modified to alter the secontext for its 266*e4a36f41SAndroid Build Coastguard Worker# accesses to the underlying FS. 267*e4a36f41SAndroid Build Coastguard Workerallow dumpstate media_rw_data_file:dir getattr; 268*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_interrupts:file r_file_perms; 269*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_zoneinfo:file r_file_perms; 270*e4a36f41SAndroid Build Coastguard Worker 271*e4a36f41SAndroid Build Coastguard Worker# Create a service for talking back to system_server 272*e4a36f41SAndroid Build Coastguard Workeradd_service(dumpstate, dumpstate_service) 273*e4a36f41SAndroid Build Coastguard Worker 274*e4a36f41SAndroid Build Coastguard Worker# use /dev/ion for screen capture 275*e4a36f41SAndroid Build Coastguard Workerallow dumpstate ion_device:chr_file r_file_perms; 276*e4a36f41SAndroid Build Coastguard Worker 277*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run top 278*e4a36f41SAndroid Build Coastguard Workerallow dumpstate proc_stat:file r_file_perms; 279*e4a36f41SAndroid Build Coastguard Worker 280*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to installd over binder 281*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, installd); 282*e4a36f41SAndroid Build Coastguard Worker 283*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run ip xfrm policy 284*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_xfrm_socket { create_socket_perms_no_ioctl nlmsg_read }; 285*e4a36f41SAndroid Build Coastguard Worker 286*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run iotop 287*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_socket create_socket_perms_no_ioctl; 288*e4a36f41SAndroid Build Coastguard Worker# newer kernels (e.g. 4.4) have a new class for sockets 289*e4a36f41SAndroid Build Coastguard Workerallow dumpstate self:netlink_generic_socket create_socket_perms_no_ioctl; 290*e4a36f41SAndroid Build Coastguard Worker 291*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to run ss 292*e4a36f41SAndroid Build Coastguard Workerallow dumpstate { domain pdx_channel_socket_type pdx_endpoint_socket_type }:socket_class_set getattr; 293*e4a36f41SAndroid Build Coastguard Worker 294*e4a36f41SAndroid Build Coastguard Worker# For when dumpstate runs df 295*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate mnt_vendor_file:dir search; 296*e4a36f41SAndroid Build Coastguard Workerdontaudit dumpstate apex_mnt_dir:dir getattr; 297*e4a36f41SAndroid Build Coastguard Worker 298*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to bufferhubd over binder 299*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, bufferhubd); 300*e4a36f41SAndroid Build Coastguard Worker 301*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to talk to mediaswcodec over binder 302*e4a36f41SAndroid Build Coastguard Workerbinder_call(dumpstate, mediaswcodec); 303*e4a36f41SAndroid Build Coastguard Worker 304*e4a36f41SAndroid Build Coastguard Worker# Allow dumpstate to kill vendor dumpstate service by init 305*e4a36f41SAndroid Build Coastguard Workerset_prop(dumpstate, ctl_dumpstate_prop) 306*e4a36f41SAndroid Build Coastguard Worker 307*e4a36f41SAndroid Build Coastguard Worker### 308*e4a36f41SAndroid Build Coastguard Worker### neverallow rules 309*e4a36f41SAndroid Build Coastguard Worker### 310*e4a36f41SAndroid Build Coastguard Worker 311*e4a36f41SAndroid Build Coastguard Worker# dumpstate has capability sys_ptrace, but should only use that capability for 312*e4a36f41SAndroid Build Coastguard Worker# accessing sensitive /proc/PID files, never for using ptrace attach. 313*e4a36f41SAndroid Build Coastguard Workerneverallow dumpstate *:process ptrace; 314*e4a36f41SAndroid Build Coastguard Worker 315*e4a36f41SAndroid Build Coastguard Worker# only system_server, dumpstate, traceur_app and shell can find the dumpstate service 316*e4a36f41SAndroid Build Coastguard Workerneverallow { 317*e4a36f41SAndroid Build Coastguard Worker domain 318*e4a36f41SAndroid Build Coastguard Worker -system_server 319*e4a36f41SAndroid Build Coastguard Worker -shell 320*e4a36f41SAndroid Build Coastguard Worker -traceur_app 321*e4a36f41SAndroid Build Coastguard Worker -dumpstate 322*e4a36f41SAndroid Build Coastguard Worker} dumpstate_service:service_manager find; 323