1*e4a36f41SAndroid Build Coastguard Worker### 2*e4a36f41SAndroid Build Coastguard Worker### Untrusted_27. 3*e4a36f41SAndroid Build Coastguard Worker### 4*e4a36f41SAndroid Build Coastguard Worker### This file defines the rules for untrusted apps running with 5*e4a36f41SAndroid Build Coastguard Worker### 25 < targetSdkVersion <= 28. 6*e4a36f41SAndroid Build Coastguard Worker### 7*e4a36f41SAndroid Build Coastguard Worker### See public/untrusted_app.te for more information about which apps are 8*e4a36f41SAndroid Build Coastguard Worker### placed in this selinux domain. 9*e4a36f41SAndroid Build Coastguard Worker### 10*e4a36f41SAndroid Build Coastguard Worker 11*e4a36f41SAndroid Build Coastguard Workertypeattribute untrusted_app_27 coredomain; 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Workerapp_domain(untrusted_app_27) 14*e4a36f41SAndroid Build Coastguard Workeruntrusted_app_domain(untrusted_app_27) 15*e4a36f41SAndroid Build Coastguard Workernet_domain(untrusted_app_27) 16*e4a36f41SAndroid Build Coastguard Workerbluetooth_domain(untrusted_app_27) 17*e4a36f41SAndroid Build Coastguard Worker 18*e4a36f41SAndroid Build Coastguard Worker# Text relocation support for API < 23. This is now disallowed for targetSdkVersion>=Q. 19*e4a36f41SAndroid Build Coastguard Worker# https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#text-relocations-enforced-for-api-level-23 20*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 { apk_data_file app_data_file asec_public_file }:file execmod; 21*e4a36f41SAndroid Build Coastguard Worker 22*e4a36f41SAndroid Build Coastguard Worker# The ability to call exec() on files in the apps home directories 23*e4a36f41SAndroid Build Coastguard Worker# for targetApi 26, 27, and 28. 24*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 app_data_file:file execute_no_trans; 25*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_27 app_data_file:file { execute execute_no_trans }; 26*e4a36f41SAndroid Build Coastguard Worker 27*e4a36f41SAndroid Build Coastguard Worker# The ability to invoke dex2oat. Historically required by ART, now only 28*e4a36f41SAndroid Build Coastguard Worker# allowed for targetApi<=28 for compat reasons. 29*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 dex2oat_exec:file rx_file_perms; 30*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`auditallow untrusted_app_27 dex2oat_exec:file rx_file_perms;') 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Worker# The ability to talk to /dev/ashmem directly. targetApi>=29 must use 33*e4a36f41SAndroid Build Coastguard Worker# ASharedMemory instead. 34*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 ashmem_device:chr_file rw_file_perms; 35*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_27 ashmem_device:chr_file open; 36*e4a36f41SAndroid Build Coastguard Worker 37*e4a36f41SAndroid Build Coastguard Worker# Read /mnt/sdcard symlink. 38*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 mnt_sdcard_file:lnk_file r_file_perms; 39*e4a36f41SAndroid Build Coastguard Worker 40*e4a36f41SAndroid Build Coastguard Worker# allow sending RTM_GETNEIGH{TBL} messages. 41*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 self:netlink_route_socket nlmsg_getneigh; 42*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_27 self:netlink_route_socket nlmsg_getneigh; 43*e4a36f41SAndroid Build Coastguard Worker 44*e4a36f41SAndroid Build Coastguard Worker# Connect to mdnsd via mdnsd socket. 45*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(untrusted_app_27, mdnsd, mdnsd) 46*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 47*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_27 mdnsd_socket:sock_file write; 48*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_27 mdnsd:unix_stream_socket connectto; 49*e4a36f41SAndroid Build Coastguard Worker') 50*e4a36f41SAndroid Build Coastguard Worker 51*e4a36f41SAndroid Build Coastguard Worker# Allow calling inotify on APKs for backwards compatibility. This is disallowed 52*e4a36f41SAndroid Build Coastguard Worker# for targetSdkVersion>=34 to remove a sidechannel. 53*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 apk_data_file:dir { watch watch_reads }; 54*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_27 apk_data_file:file { watch watch_reads }; 55*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 56*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_27 apk_data_file:dir { watch watch_reads }; 57*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_27 apk_data_file:file { watch watch_reads }; 58*e4a36f41SAndroid Build Coastguard Worker') 59