1*e4a36f41SAndroid Build Coastguard Worker### 2*e4a36f41SAndroid Build Coastguard Worker### Untrusted_app_25 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### targetSdkVersion <= 25. 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_25 coredomain; 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Workerapp_domain(untrusted_app_25) 14*e4a36f41SAndroid Build Coastguard Workeruntrusted_app_domain(untrusted_app_25) 15*e4a36f41SAndroid Build Coastguard Workernet_domain(untrusted_app_25) 16*e4a36f41SAndroid Build Coastguard Workerbluetooth_domain(untrusted_app_25) 17*e4a36f41SAndroid Build Coastguard Worker 18*e4a36f41SAndroid Build Coastguard Worker# b/35917228 - /proc/misc access 19*e4a36f41SAndroid Build Coastguard Worker# This will go away in a future Android release 20*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 proc_misc:file r_file_perms; 21*e4a36f41SAndroid Build Coastguard Worker 22*e4a36f41SAndroid Build Coastguard Worker# Access to /proc/tty/drivers, to allow apps to determine if they 23*e4a36f41SAndroid Build Coastguard Worker# are running in an emulated environment. 24*e4a36f41SAndroid Build Coastguard Worker# b/33214085 b/33814662 b/33791054 b/33211769 25*e4a36f41SAndroid Build Coastguard Worker# https://github.com/strazzere/anti-emulator/blob/master/AntiEmulator/src/diff/strazzere/anti/emulator/FindEmulator.java 26*e4a36f41SAndroid Build Coastguard Worker# This will go away in a future Android release 27*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 proc_tty_drivers:file r_file_perms; 28*e4a36f41SAndroid Build Coastguard Worker 29*e4a36f41SAndroid Build Coastguard Worker# Text relocation support for API < 23. This is now disallowed for targetSdkVersion>=Q. 30*e4a36f41SAndroid Build Coastguard Worker# https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#text-relocations-enforced-for-api-level-23 31*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 { apk_data_file app_data_file asec_public_file }:file execmod; 32*e4a36f41SAndroid Build Coastguard Worker 33*e4a36f41SAndroid Build Coastguard Worker# The ability to call exec() on files in the apps home directories 34*e4a36f41SAndroid Build Coastguard Worker# for targetApi<=25. This is also allowed for targetAPIs 26, 27, 35*e4a36f41SAndroid Build Coastguard Worker# and 28 in untrusted_app_27.te. 36*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 app_data_file:file execute_no_trans; 37*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_25 app_data_file:file { execute execute_no_trans }; 38*e4a36f41SAndroid Build Coastguard Worker 39*e4a36f41SAndroid Build Coastguard Worker# The ability to invoke dex2oat. Historically required by ART, now only 40*e4a36f41SAndroid Build Coastguard Worker# allowed for targetApi<=28 for compat reasons. 41*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 dex2oat_exec:file rx_file_perms; 42*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`auditallow untrusted_app_25 dex2oat_exec:file rx_file_perms;') 43*e4a36f41SAndroid Build Coastguard Worker 44*e4a36f41SAndroid Build Coastguard Worker# The ability to talk to /dev/ashmem directly. targetApi>=29 must use 45*e4a36f41SAndroid Build Coastguard Worker# ASharedMemory instead. 46*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 ashmem_device:chr_file rw_file_perms; 47*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_25 ashmem_device:chr_file open; 48*e4a36f41SAndroid Build Coastguard Worker 49*e4a36f41SAndroid Build Coastguard Worker# Read /mnt/sdcard symlink. 50*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 mnt_sdcard_file:lnk_file r_file_perms; 51*e4a36f41SAndroid Build Coastguard Worker 52*e4a36f41SAndroid Build Coastguard Worker# allow sending RTM_GETNEIGH{TBL} messages. 53*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 self:netlink_route_socket nlmsg_getneigh; 54*e4a36f41SAndroid Build Coastguard Workerauditallow untrusted_app_25 self:netlink_route_socket nlmsg_getneigh; 55*e4a36f41SAndroid Build Coastguard Worker 56*e4a36f41SAndroid Build Coastguard Worker# Connect to mdnsd via mdnsd socket. 57*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(untrusted_app_25, mdnsd, mdnsd) 58*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 59*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_25 mdnsd_socket:sock_file write; 60*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_25 mdnsd:unix_stream_socket connectto; 61*e4a36f41SAndroid Build Coastguard Worker') 62*e4a36f41SAndroid Build Coastguard Worker 63*e4a36f41SAndroid Build Coastguard Worker# Allow calling inotify on APKs for backwards compatibility. This is disallowed 64*e4a36f41SAndroid Build Coastguard Worker# for targetSdkVersion>=34 to remove a sidechannel. 65*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 apk_data_file:dir { watch watch_reads }; 66*e4a36f41SAndroid Build Coastguard Workerallow untrusted_app_25 apk_data_file:file { watch watch_reads }; 67*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 68*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_25 apk_data_file:dir { watch watch_reads }; 69*e4a36f41SAndroid Build Coastguard Worker auditallow untrusted_app_25 apk_data_file:file { watch watch_reads }; 70*e4a36f41SAndroid Build Coastguard Worker') 71