blob: 7177b923fdee718b4e6b87d07f2883ee8fb34f19 [file] [log] [blame]
William Hester5f486c72019-01-15 13:39:30 -08001# Allow apps to read the Test Harness Mode property. This property is used in
2# the implementation of ActivityManager.isDeviceInTestHarnessMode()
3get_prop(appdomain, test_harness_prop)
4
Inseob Kimdbcc4592020-05-21 20:12:55 +09005get_prop(appdomain, boot_status_prop)
6get_prop(appdomain, dalvik_config_prop)
Inseob Kimdddf6f52020-07-06 22:24:11 +09007get_prop(appdomain, media_config_prop)
Inseob Kim5eacf722020-07-01 01:27:49 +09008get_prop(appdomain, packagemanager_config_prop)
Inseob Kim4ae7ec12020-08-03 14:29:47 +09009get_prop(appdomain, radio_control_prop)
Inseob Kimdbcc4592020-05-21 20:12:55 +090010get_prop(appdomain, surfaceflinger_color_prop)
11get_prop(appdomain, systemsound_config_prop)
Inseob Kim641cffe2020-06-05 10:40:16 +090012get_prop(appdomain, telephony_config_prop)
Inseob Kimdbcc4592020-05-21 20:12:55 +090013get_prop(appdomain, userspace_reboot_config_prop)
14get_prop(appdomain, vold_config_prop)
Hongguang Chen67c36882020-07-27 15:15:53 -070015get_prop(appdomain, adbd_config_prop)
Thierry Strudel195149f2021-12-22 19:13:25 -080016get_prop(appdomain, dck_prop)
Inseob Kimdbcc4592020-05-21 20:12:55 +090017
Calin Juravle0b2ca6c2021-05-18 15:33:08 -070018# Allow ART to be configurable via device_config properties
19# (ART "runs" inside the app process)
20get_prop(appdomain, device_config_runtime_native_prop)
21get_prop(appdomain, device_config_runtime_native_boot_prop)
22
Florian Mayer5e522812019-10-08 16:15:14 +010023userdebug_or_eng(`perfetto_producer({ appdomain })')
24
Jeff Vander Stoep607bc672019-12-16 10:59:03 +010025# Prevent apps from causing presubmit failures.
26# Apps can cause selinux denials by accessing CE storage
27# and/or external storage. In either case, the selinux denial is
28# not the cause of the failure, but just a symptom that
29# storage isn't ready. Many apps handle the failure appropriately.
30#
31# Apps cannot access external storage before it becomes available.
32dontaudit appdomain storage_stub_file:dir getattr;
33# Attempts to write to system_data_file is generally a sign
34# that apps are attempting to access encrypted storage before
35# the ACTION_USER_UNLOCKED intent is delivered. Apps are not
36# allowed to write to CE storage before it's available.
37# Attempting to do so will be blocked by both selinux and unix
38# permissions.
39dontaudit appdomain system_data_file:dir write;
Jeff Vander Stoep67896ee2020-04-02 13:36:17 +020040# Apps should not be reading vendor-defined properties.
41dontaudit appdomain vendor_default_prop:file read;
Jeff Vander Stoep607bc672019-12-16 10:59:03 +010042
Zimb61bcc82021-04-08 12:20:26 +010043# Access to /mnt/media_rw/<vol> (limited by DAC to apps with external_storage gid)
44allow appdomain mnt_media_rw_file:dir search;
45
Nathan Haroldee268642017-12-14 18:20:30 -080046neverallow appdomain system_server:udp_socket {
Nathan Harold252b0152018-03-27 06:34:54 -070047 accept append bind create ioctl listen lock name_bind
48 relabelfrom relabelto setattr shutdown };
Nick Kralevich1e5021c2018-11-28 17:50:24 -080049
50# Transition to a non-app domain.
51# Exception for the shell and su domains, can transition to runas, etc.
Nick Kralevich0eb0a162018-12-12 09:06:05 -080052# Exception for crash_dump to allow for app crash reporting.
53# Exception for renderscript binaries (/system/bin/bcc, /system/bin/ld.mc)
54# to allow renderscript to create privileged executable files.
55neverallow { appdomain -shell userdebug_or_eng(`-su') }
56 { domain -appdomain -crash_dump -rs }:process { transition };
57neverallow { appdomain -shell userdebug_or_eng(`-su') }
58 { domain -appdomain }:process { dyntransition };
Daniel Rosenbergafede842020-05-11 22:50:40 -070059
60# Don't allow regular apps access to storage configuration properties.
61neverallow { appdomain -mediaprovider_app } storage_config_prop:file no_rw_file_perms;
Peiyong Lin37dea072020-06-03 12:20:41 -070062
Inseob Kimc80b0242020-07-16 22:25:47 +090063# Allow to read sendbug.preferred.domain
64get_prop(appdomain, sendbug_config_prop)
65
Peiyong Lin37dea072020-06-03 12:20:41 -070066# Allow to read graphics related properties.
67get_prop(appdomain, graphics_config_prop)
Inseob Kimc97a97c2020-07-20 20:26:07 +090068
69# Allow to read persist.config.calibration_fac
70get_prop(appdomain, camera_calibration_prop)
Inseob Kim0cef0fe2020-11-17 13:54:52 +090071
72# Allow to read db.log.detailed, db.log.slow_query_threshold*
73get_prop(appdomain, sqlite_log_prop)
Orion Hodson8f75f762020-10-16 15:29:55 +010074
Seigo Nonaka9c3707f2021-01-21 13:08:31 -080075# Allow font file read by apps.
76allow appdomain font_data_file:file r_file_perms;
77allow appdomain font_data_file:dir r_dir_perms;
78
Martijn Coenen4825e862021-03-29 13:51:35 +020079# Enter /data/misc/apexdata/
80allow appdomain apex_module_data_file:dir search;
Orion Hodson13ee6532021-04-27 15:51:33 +010081# Read /data/misc/apexdata/com.android.art, execute signed AOT artifacts.
Martijn Coenen4825e862021-03-29 13:51:35 +020082allow appdomain apex_art_data_file:dir r_dir_perms;
Orion Hodson13ee6532021-04-27 15:51:33 +010083allow appdomain apex_art_data_file:file rx_file_perms;
Orion Hodson8f75f762020-10-16 15:29:55 +010084
Josh Gaoce1c4a52021-02-03 18:35:06 -080085# Allow access to tombstones if an fd to one is given to you.
86# This is restricted by unix permissions, so an app must go through system_server to get one.
87allow appdomain tombstone_data_file:file { getattr read };
88neverallow appdomain tombstone_data_file:file ~{ getattr read };
89
Orion Hodson8f75f762020-10-16 15:29:55 +010090# Sensitive app domains are not allowed to execute from /data
91# to prevent persistence attacks and ensure all code is executed
92# from read-only locations.
93neverallow {
94 bluetooth
95 isolated_app
96 nfc
97 radio
98 shared_relro
99 system_app
100} {
101 data_file_type
102 -apex_art_data_file
103 -dalvikcache_data_file
104 -system_data_file # shared libs in apks
105 -apk_data_file
106}:file no_x_file_perms;
Tianjieb729aa62021-10-05 22:13:20 -0700107
108# For now, don't allow apps other than gmscore to access /data/misc_ce/<userid>/checkin
109neverallow { appdomain -gmscore_app } checkin_data_file:dir *;
110neverallow { appdomain -gmscore_app } checkin_data_file:file *;