1*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, apex_ready_prop) 2*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, boot_status_prop) 3*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, camera_config_prop) 4*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, dalvik_config_prop_type) 5*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, dalvik_runtime_prop) 6*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, exported_pm_prop) 7*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, ffs_config_prop) 8*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, graphics_config_prop) 9*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, graphics_config_writable_prop) 10*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, hdmi_config_prop) 11*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, init_service_status_private_prop) 12*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, lmkd_config_prop) 13*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, localization_prop) 14*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, pm_prop) 15*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, radio_control_prop) 16*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, rollback_test_prop) 17*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, setupwizard_prop) 18*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, setupwizard_mode_prop) 19*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, sqlite_log_prop) 20*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, storagemanager_config_prop) 21*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, surfaceflinger_color_prop) 22*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, systemsound_config_prop) 23*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, telephony_config_prop) 24*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, usb_config_prop) 25*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, usb_control_prop) 26*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, userspace_reboot_config_prop) 27*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, vold_config_prop) 28*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, vts_status_prop) 29*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, zygote_config_prop) 30*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, zygote_wrap_prop) 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Worker# TODO(b/170590987): remove this after cleaning up default_prop 33*e4a36f41SAndroid Build Coastguard Workerget_prop(coredomain, default_prop) 34*e4a36f41SAndroid Build Coastguard Worker 35*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 36*e4a36f41SAndroid Build Coastguard Workerneverallow { 37*e4a36f41SAndroid Build Coastguard Worker coredomain 38*e4a36f41SAndroid Build Coastguard Worker 39*e4a36f41SAndroid Build Coastguard Worker # for chowning 40*e4a36f41SAndroid Build Coastguard Worker -init 41*e4a36f41SAndroid Build Coastguard Worker 42*e4a36f41SAndroid Build Coastguard Worker # generic access to sysfs_type 43*e4a36f41SAndroid Build Coastguard Worker -apexd 44*e4a36f41SAndroid Build Coastguard Worker -ueventd 45*e4a36f41SAndroid Build Coastguard Worker -vold 46*e4a36f41SAndroid Build Coastguard Worker} sysfs_leds:file *; 47*e4a36f41SAndroid Build Coastguard Worker') 48*e4a36f41SAndroid Build Coastguard Worker 49*e4a36f41SAndroid Build Coastguard Worker# On TREBLE devices, a limited set of files in /vendor are accessible to 50*e4a36f41SAndroid Build Coastguard Worker# only a few allowlisted coredomains to keep system/vendor separation. 51*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 52*e4a36f41SAndroid Build Coastguard Worker # Limit access to /vendor/app 53*e4a36f41SAndroid Build Coastguard Worker neverallow { 54*e4a36f41SAndroid Build Coastguard Worker coredomain 55*e4a36f41SAndroid Build Coastguard Worker -appdomain 56*e4a36f41SAndroid Build Coastguard Worker -artd 57*e4a36f41SAndroid Build Coastguard Worker -dex2oat 58*e4a36f41SAndroid Build Coastguard Worker -idmap 59*e4a36f41SAndroid Build Coastguard Worker -init 60*e4a36f41SAndroid Build Coastguard Worker -installd 61*e4a36f41SAndroid Build Coastguard Worker -heapprofd 62*e4a36f41SAndroid Build Coastguard Worker -postinstall_dexopt 63*e4a36f41SAndroid Build Coastguard Worker -rs # spawned by appdomain, so carryover the exception above 64*e4a36f41SAndroid Build Coastguard Worker -system_server 65*e4a36f41SAndroid Build Coastguard Worker -traced_perf 66*e4a36f41SAndroid Build Coastguard Worker } vendor_app_file:dir { open read getattr search }; 67*e4a36f41SAndroid Build Coastguard Worker') 68*e4a36f41SAndroid Build Coastguard Worker 69*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 70*e4a36f41SAndroid Build Coastguard Worker neverallow { 71*e4a36f41SAndroid Build Coastguard Worker coredomain 72*e4a36f41SAndroid Build Coastguard Worker -appdomain 73*e4a36f41SAndroid Build Coastguard Worker -artd 74*e4a36f41SAndroid Build Coastguard Worker -dex2oat 75*e4a36f41SAndroid Build Coastguard Worker -idmap 76*e4a36f41SAndroid Build Coastguard Worker -init 77*e4a36f41SAndroid Build Coastguard Worker -installd 78*e4a36f41SAndroid Build Coastguard Worker -heapprofd 79*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-profcollectd') 80*e4a36f41SAndroid Build Coastguard Worker -postinstall_dexopt 81*e4a36f41SAndroid Build Coastguard Worker -profman 82*e4a36f41SAndroid Build Coastguard Worker -rs # spawned by appdomain, so carryover the exception above 83*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-simpleperf_boot') 84*e4a36f41SAndroid Build Coastguard Worker -system_server 85*e4a36f41SAndroid Build Coastguard Worker -traced_perf 86*e4a36f41SAndroid Build Coastguard Worker -mediaserver 87*e4a36f41SAndroid Build Coastguard Worker } vendor_app_file:file r_file_perms; 88*e4a36f41SAndroid Build Coastguard Worker') 89*e4a36f41SAndroid Build Coastguard Worker 90*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 91*e4a36f41SAndroid Build Coastguard Worker # Limit access to /vendor/overlay 92*e4a36f41SAndroid Build Coastguard Worker neverallow { 93*e4a36f41SAndroid Build Coastguard Worker coredomain 94*e4a36f41SAndroid Build Coastguard Worker -appdomain 95*e4a36f41SAndroid Build Coastguard Worker -artd 96*e4a36f41SAndroid Build Coastguard Worker -dex2oat 97*e4a36f41SAndroid Build Coastguard Worker -idmap 98*e4a36f41SAndroid Build Coastguard Worker -init 99*e4a36f41SAndroid Build Coastguard Worker -installd 100*e4a36f41SAndroid Build Coastguard Worker -postinstall_dexopt 101*e4a36f41SAndroid Build Coastguard Worker -rs # spawned by appdomain, so carryover the exception above 102*e4a36f41SAndroid Build Coastguard Worker -system_server 103*e4a36f41SAndroid Build Coastguard Worker -traced_perf 104*e4a36f41SAndroid Build Coastguard Worker -app_zygote 105*e4a36f41SAndroid Build Coastguard Worker -webview_zygote 106*e4a36f41SAndroid Build Coastguard Worker -zygote 107*e4a36f41SAndroid Build Coastguard Worker -heapprofd 108*e4a36f41SAndroid Build Coastguard Worker } vendor_overlay_file:dir { getattr open read search }; 109*e4a36f41SAndroid Build Coastguard Worker') 110*e4a36f41SAndroid Build Coastguard Worker 111*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 112*e4a36f41SAndroid Build Coastguard Worker neverallow { 113*e4a36f41SAndroid Build Coastguard Worker coredomain 114*e4a36f41SAndroid Build Coastguard Worker -appdomain 115*e4a36f41SAndroid Build Coastguard Worker -artd 116*e4a36f41SAndroid Build Coastguard Worker -dex2oat 117*e4a36f41SAndroid Build Coastguard Worker -idmap 118*e4a36f41SAndroid Build Coastguard Worker -init 119*e4a36f41SAndroid Build Coastguard Worker -installd 120*e4a36f41SAndroid Build Coastguard Worker -postinstall_dexopt 121*e4a36f41SAndroid Build Coastguard Worker -rs # spawned by appdomain, so carryover the exception above 122*e4a36f41SAndroid Build Coastguard Worker -system_server 123*e4a36f41SAndroid Build Coastguard Worker -traced_perf 124*e4a36f41SAndroid Build Coastguard Worker -app_zygote 125*e4a36f41SAndroid Build Coastguard Worker -webview_zygote 126*e4a36f41SAndroid Build Coastguard Worker -zygote 127*e4a36f41SAndroid Build Coastguard Worker -heapprofd 128*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-profcollectd') 129*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-simpleperf_boot') 130*e4a36f41SAndroid Build Coastguard Worker } vendor_overlay_file:file open; 131*e4a36f41SAndroid Build Coastguard Worker') 132*e4a36f41SAndroid Build Coastguard Worker 133*e4a36f41SAndroid Build Coastguard Worker# Core domains are not permitted to use kernel interfaces which are not 134*e4a36f41SAndroid Build Coastguard Worker# explicitly labeled. 135*e4a36f41SAndroid Build Coastguard Worker# TODO(b/65643247): Apply these neverallow rules to all coredomain. 136*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 137*e4a36f41SAndroid Build Coastguard Worker # /proc 138*e4a36f41SAndroid Build Coastguard Worker neverallow { 139*e4a36f41SAndroid Build Coastguard Worker coredomain 140*e4a36f41SAndroid Build Coastguard Worker -init 141*e4a36f41SAndroid Build Coastguard Worker -vold 142*e4a36f41SAndroid Build Coastguard Worker } proc:file no_rw_file_perms; 143*e4a36f41SAndroid Build Coastguard Worker 144*e4a36f41SAndroid Build Coastguard Worker # /sys 145*e4a36f41SAndroid Build Coastguard Worker neverallow { 146*e4a36f41SAndroid Build Coastguard Worker coredomain 147*e4a36f41SAndroid Build Coastguard Worker -apexd 148*e4a36f41SAndroid Build Coastguard Worker -init 149*e4a36f41SAndroid Build Coastguard Worker -ueventd 150*e4a36f41SAndroid Build Coastguard Worker is_flag_enabled(RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT, `-vfio_handler') 151*e4a36f41SAndroid Build Coastguard Worker -vold 152*e4a36f41SAndroid Build Coastguard Worker } sysfs:file no_rw_file_perms; 153*e4a36f41SAndroid Build Coastguard Worker 154*e4a36f41SAndroid Build Coastguard Worker # /dev 155*e4a36f41SAndroid Build Coastguard Worker neverallow { 156*e4a36f41SAndroid Build Coastguard Worker coredomain 157*e4a36f41SAndroid Build Coastguard Worker -apexd 158*e4a36f41SAndroid Build Coastguard Worker -fsck 159*e4a36f41SAndroid Build Coastguard Worker -init 160*e4a36f41SAndroid Build Coastguard Worker -ueventd 161*e4a36f41SAndroid Build Coastguard Worker } device:{ blk_file file } no_rw_file_perms; 162*e4a36f41SAndroid Build Coastguard Worker 163*e4a36f41SAndroid Build Coastguard Worker # debugfs 164*e4a36f41SAndroid Build Coastguard Worker neverallow { 165*e4a36f41SAndroid Build Coastguard Worker coredomain 166*e4a36f41SAndroid Build Coastguard Worker no_debugfs_restriction(` 167*e4a36f41SAndroid Build Coastguard Worker -dumpstate 168*e4a36f41SAndroid Build Coastguard Worker -init 169*e4a36f41SAndroid Build Coastguard Worker -system_server 170*e4a36f41SAndroid Build Coastguard Worker ') 171*e4a36f41SAndroid Build Coastguard Worker } debugfs:file no_rw_file_perms; 172*e4a36f41SAndroid Build Coastguard Worker 173*e4a36f41SAndroid Build Coastguard Worker # tracefs 174*e4a36f41SAndroid Build Coastguard Worker neverallow { 175*e4a36f41SAndroid Build Coastguard Worker coredomain 176*e4a36f41SAndroid Build Coastguard Worker -atrace 177*e4a36f41SAndroid Build Coastguard Worker -dumpstate 178*e4a36f41SAndroid Build Coastguard Worker -gpuservice 179*e4a36f41SAndroid Build Coastguard Worker -init 180*e4a36f41SAndroid Build Coastguard Worker -lmkd 181*e4a36f41SAndroid Build Coastguard Worker -traced_perf 182*e4a36f41SAndroid Build Coastguard Worker -traced_probes 183*e4a36f41SAndroid Build Coastguard Worker -shell 184*e4a36f41SAndroid Build Coastguard Worker -system_server 185*e4a36f41SAndroid Build Coastguard Worker -traceur_app 186*e4a36f41SAndroid Build Coastguard Worker -prefetch 187*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-profcollectd') 188*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-simpleperf_boot') 189*e4a36f41SAndroid Build Coastguard Worker } debugfs_tracing:file no_rw_file_perms; 190*e4a36f41SAndroid Build Coastguard Worker 191*e4a36f41SAndroid Build Coastguard Worker # inotifyfs 192*e4a36f41SAndroid Build Coastguard Worker neverallow { 193*e4a36f41SAndroid Build Coastguard Worker coredomain 194*e4a36f41SAndroid Build Coastguard Worker -init 195*e4a36f41SAndroid Build Coastguard Worker } inotify:file no_rw_file_perms; 196*e4a36f41SAndroid Build Coastguard Worker 197*e4a36f41SAndroid Build Coastguard Worker # pstorefs 198*e4a36f41SAndroid Build Coastguard Worker neverallow { 199*e4a36f41SAndroid Build Coastguard Worker coredomain 200*e4a36f41SAndroid Build Coastguard Worker -bootstat 201*e4a36f41SAndroid Build Coastguard Worker -charger 202*e4a36f41SAndroid Build Coastguard Worker -dumpstate 203*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-incidentd') 204*e4a36f41SAndroid Build Coastguard Worker -init 205*e4a36f41SAndroid Build Coastguard Worker -logd 206*e4a36f41SAndroid Build Coastguard Worker -logpersist 207*e4a36f41SAndroid Build Coastguard Worker -recovery_persist 208*e4a36f41SAndroid Build Coastguard Worker -recovery_refresh 209*e4a36f41SAndroid Build Coastguard Worker -shell 210*e4a36f41SAndroid Build Coastguard Worker -system_server 211*e4a36f41SAndroid Build Coastguard Worker } pstorefs:file no_rw_file_perms; 212*e4a36f41SAndroid Build Coastguard Worker 213*e4a36f41SAndroid Build Coastguard Worker # configfs 214*e4a36f41SAndroid Build Coastguard Worker neverallow { 215*e4a36f41SAndroid Build Coastguard Worker coredomain 216*e4a36f41SAndroid Build Coastguard Worker -init 217*e4a36f41SAndroid Build Coastguard Worker -system_server 218*e4a36f41SAndroid Build Coastguard Worker } configfs:file no_rw_file_perms; 219*e4a36f41SAndroid Build Coastguard Worker 220*e4a36f41SAndroid Build Coastguard Worker # functionfs 221*e4a36f41SAndroid Build Coastguard Worker neverallow { 222*e4a36f41SAndroid Build Coastguard Worker coredomain 223*e4a36f41SAndroid Build Coastguard Worker -adbd 224*e4a36f41SAndroid Build Coastguard Worker -adbd_tradeinmode 225*e4a36f41SAndroid Build Coastguard Worker -init 226*e4a36f41SAndroid Build Coastguard Worker -mediaprovider 227*e4a36f41SAndroid Build Coastguard Worker -system_server 228*e4a36f41SAndroid Build Coastguard Worker } functionfs:file no_rw_file_perms; 229*e4a36f41SAndroid Build Coastguard Worker 230*e4a36f41SAndroid Build Coastguard Worker # usbfs and binfmt_miscfs 231*e4a36f41SAndroid Build Coastguard Worker neverallow { 232*e4a36f41SAndroid Build Coastguard Worker coredomain 233*e4a36f41SAndroid Build Coastguard Worker -init 234*e4a36f41SAndroid Build Coastguard Worker }{ usbfs binfmt_miscfs }:file no_rw_file_perms; 235*e4a36f41SAndroid Build Coastguard Worker 236*e4a36f41SAndroid Build Coastguard Worker # dmabuf heaps 237*e4a36f41SAndroid Build Coastguard Worker neverallow { 238*e4a36f41SAndroid Build Coastguard Worker coredomain 239*e4a36f41SAndroid Build Coastguard Worker -init 240*e4a36f41SAndroid Build Coastguard Worker -ueventd 241*e4a36f41SAndroid Build Coastguard Worker }{ 242*e4a36f41SAndroid Build Coastguard Worker dmabuf_heap_device_type 243*e4a36f41SAndroid Build Coastguard Worker -dmabuf_system_heap_device 244*e4a36f41SAndroid Build Coastguard Worker -dmabuf_system_secure_heap_device 245*e4a36f41SAndroid Build Coastguard Worker }:chr_file no_rw_file_perms; 246*e4a36f41SAndroid Build Coastguard Worker') 247*e4a36f41SAndroid Build Coastguard Worker 248*e4a36f41SAndroid Build Coastguard Worker# Following /dev nodes must not be directly accessed by coredomain, but should 249*e4a36f41SAndroid Build Coastguard Worker# instead be wrapped by HALs. 250*e4a36f41SAndroid Build Coastguard Workerneverallow coredomain { 251*e4a36f41SAndroid Build Coastguard Worker iio_device 252*e4a36f41SAndroid Build Coastguard Worker radio_device 253*e4a36f41SAndroid Build Coastguard Worker}:chr_file { open read append write ioctl }; 254*e4a36f41SAndroid Build Coastguard Worker 255*e4a36f41SAndroid Build Coastguard Worker# TODO(b/120243891): HAL permission to tee_device is included into coredomain 256*e4a36f41SAndroid Build Coastguard Worker# on non-Treble devices. 257*e4a36f41SAndroid Build Coastguard Workerfull_treble_only(` 258*e4a36f41SAndroid Build Coastguard Worker neverallow coredomain tee_device:chr_file { open read append write ioctl }; 259*e4a36f41SAndroid Build Coastguard Worker') 260