• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1###
2### Apps that run with the system UID, e.g. com.android.system.ui,
3### com.android.settings.  These are not as privileged as the system
4### server.
5###
6
7typeattribute system_app coredomain, mlstrustedsubject;
8
9app_domain(system_app)
10net_domain(system_app)
11binder_service(system_app)
12
13# android.ui and system.ui
14allow system_app rootfs:dir getattr;
15
16# read/write certain subdirectories of /data/data for system UID apps.
17allow system_app system_app_data_file:dir create_dir_perms;
18allow system_app system_app_data_file:{ file lnk_file } create_file_perms;
19
20# Read and write to /data/misc/user.
21allow system_app misc_user_data_file:dir create_dir_perms;
22allow system_app misc_user_data_file:file create_file_perms;
23
24# Access to apex files stored on /data (b/136063500)
25# Needed so that Settings can access NOTICE files inside apex
26# files located in the assets/ directory.
27allow system_app apex_data_file:dir search;
28allow system_app staging_data_file:file r_file_perms;
29
30# Read wallpaper file.
31allow system_app wallpaper_file:file r_file_perms;
32
33# Read icon file.
34allow system_app icon_file:file r_file_perms;
35
36# Write to properties
37set_prop(system_app, adaptive_haptics_prop)
38set_prop(system_app, arm64_memtag_prop)
39set_prop(system_app, bluetooth_a2dp_offload_prop)
40set_prop(system_app, bluetooth_audio_hal_prop)
41set_prop(system_app, bluetooth_prop)
42set_prop(system_app, debug_prop)
43set_prop(system_app, system_prop)
44set_prop(system_app, exported_bluetooth_prop)
45set_prop(system_app, exported_system_prop)
46set_prop(system_app, exported3_system_prop)
47set_prop(system_app, gesture_prop)
48set_prop(system_app, locale_prop)
49set_prop(system_app, logd_prop)
50set_prop(system_app, net_radio_prop)
51set_prop(system_app, timezone_prop)
52set_prop(system_app, usb_control_prop)
53set_prop(system_app, usb_prop)
54set_prop(system_app, log_tag_prop)
55set_prop(system_app, drm_forcel3_prop)
56userdebug_or_eng(`set_prop(system_app, logpersistd_logging_prop)')
57auditallow system_app net_radio_prop:property_service set;
58auditallow system_app usb_control_prop:property_service set;
59auditallow system_app usb_prop:property_service set;
60# Allow Settings to enable Dynamic System Update
61set_prop(system_app, dynamic_system_prop)
62
63# ctl interface
64set_prop(system_app, ctl_default_prop)
65set_prop(system_app, ctl_bugreport_prop)
66
67# Allow developer settings to query gsid status
68get_prop(system_app, gsid_prop)
69
70# Allow developer settings to check 16k pages boot option status
71get_prop(system_app, enable_16k_pages_prop)
72
73# Allow developer settings to check virtualization capabilities
74get_prop(system_app, hypervisor_prop)
75
76# Create /data/anr/traces.txt.
77allow system_app anr_data_file:dir ra_dir_perms;
78allow system_app anr_data_file:file create_file_perms;
79
80# Settings need to access app name and icon from asec
81allow system_app asec_apk_file:file r_file_perms;
82
83# Allow system apps (like Settings) to interact with statsd
84binder_call(system_app, statsd)
85
86# Allow system apps to interact with incidentd
87binder_call(system_app, incidentd)
88
89# Allow system apps (Settings) to call into update_engine
90# in order to apply update to switch from 4k kernel to 16K and vice-versa
91binder_use(system_app)
92allow system_app update_engine_stable_service:service_manager find;
93binder_call(system_app, update_engine)
94
95# Allow system app to interact with Dumpstate HAL
96hal_client_domain(system_app, hal_dumpstate)
97
98allow system_app servicemanager:service_manager list;
99# TODO: scope this down? Too broad?
100allow system_app {
101  service_manager_type
102  -apex_service
103  -dnsresolver_service
104  -dumpstate_service
105  -installd_service
106  -lpdump_service
107  -mdns_service
108  -netd_service
109  -system_suspend_control_internal_service
110  -system_suspend_control_service
111  -tracingproxy_service
112  -virtual_touchpad_service
113  -vold_service
114  -default_android_service
115}:service_manager find;
116# suppress denials for services system_app should not be accessing.
117dontaudit system_app {
118  dnsresolver_service
119  dumpstate_service
120  installd_service
121  mdns_service
122  netd_service
123  virtual_touchpad_service
124  vold_service
125}:service_manager find;
126
127# suppress denials caused by debugfs_tracing
128dontaudit system_app debugfs_tracing:file rw_file_perms;
129
130# Ignore access to memory properties for Settings.
131dontaudit system_app proc_pagetypeinfo:file r_file_perms;
132dontaudit system_app sysfs_zram:dir search;
133
134allow system_app keystore:keystore2_key {
135    delete
136    get_info
137    grant
138    rebind
139    update
140    use
141};
142
143# Allow Settings to manage WI-FI keys.
144allow system_app wifi_key:keystore2_key {
145    delete
146    get_info
147    rebind
148    update
149    use
150};
151
152# settings app reads /proc/version
153allow system_app {
154  proc_version
155}:file r_file_perms;
156
157# Allow system apps to modify cgroup attributes and migrate processes
158allow system_app cgroup:file w_file_perms;
159allow system_app cgroup_v2:file w_file_perms;
160allow system_app cgroup_v2:dir w_dir_perms;
161
162control_logd(system_app)
163read_runtime_log_tags(system_app)
164get_prop(system_app, device_logging_prop)
165
166# allow system apps to use UDP sockets provided by the system server but not
167# modify them other than to connect
168allow system_app system_server:udp_socket {
169        connect getattr read recvfrom sendto write getopt setopt };
170
171# allow system apps to read game manager related sysrops
172get_prop(system_app, game_manager_config_prop)
173
174# Settings app reads ro.oem_unlock_supported
175get_prop(system_app, oem_unlock_prop)
176
177# Settings app reads ro.usb.uvc.enabled
178get_prop(system_app, usb_uvc_enabled_prop)
179
180# Settings app reads and writes the wifi blob database
181allow system_app connectivityblob_data_file:dir rw_dir_perms;
182allow system_app connectivityblob_data_file:file create_file_perms;
183
184###
185### Neverallow rules
186###
187
188# app domains which access /dev/fuse should not run as system_app
189neverallow system_app fuse_device:chr_file *;
190
191# Apps which run as UID=system should not rely on any attacker controlled
192# filesystem locations, such as /data/local/tmp. For /data/local/tmp, we
193# allow writes to files passed by file descriptor to support dumpstate and
194# bug reports, but not reads.
195neverallow system_app shell_data_file:dir { no_w_dir_perms open search read };
196neverallow system_app shell_data_file:file { open read ioctl lock };
197
198# system_app should be the only domain writing the adaptive haptics prop
199neverallow { domain -init -system_app } adaptive_haptics_prop:property_service set;
200# system_app should be the only domain writing the force l3 prop
201neverallow { domain -init -system_app } drm_forcel3_prop:property_service set;
202
203allow system_app vendor_boot_ota_file:dir { r_dir_perms };
204allow system_app vendor_boot_ota_file:file { r_file_perms };
205
206# allow system_app to read system_dlkm_file for /system_dlkm/etc/NOTICE.xml.gz
207allow system_app system_dlkm_file:dir search;
208allow system_app system_dlkm_file:file { getattr open read };
209