• 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# Allow Settings to access le audio mode property
64set_prop(system_app, bluetooth_lea_mode_prop)
65
66# ctl interface
67set_prop(system_app, ctl_default_prop)
68set_prop(system_app, ctl_bugreport_prop)
69
70# Allow developer settings to query gsid status
71get_prop(system_app, gsid_prop)
72
73# Allow developer settings to check 16k pages boot option status
74get_prop(system_app, enable_16k_pages_prop)
75
76# Allow developer settings to check virtualization capabilities
77get_prop(system_app, hypervisor_prop)
78
79# Create /data/anr/traces.txt.
80allow system_app anr_data_file:dir ra_dir_perms;
81allow system_app anr_data_file:file create_file_perms;
82
83# Settings need to access app name and icon from asec
84allow system_app asec_apk_file:file r_file_perms;
85
86# Allow system apps (like Settings) to interact with statsd
87binder_call(system_app, statsd)
88
89# Allow system apps to interact with incidentd
90binder_call(system_app, incidentd)
91
92# Allow system apps (Settings) to call into update_engine
93# in order to apply update to switch from 4k kernel to 16K and vice-versa
94binder_use(system_app)
95allow system_app update_engine_stable_service:service_manager find;
96binder_call(system_app, update_engine)
97
98# Allow system app to interact with Dumpstate HAL
99hal_client_domain(system_app, hal_dumpstate)
100
101allow system_app servicemanager:service_manager list;
102# TODO: scope this down? Too broad?
103allow system_app {
104  service_manager_type
105  -apex_service
106  -dnsresolver_service
107  -dumpstate_service
108  -installd_service
109  -lpdump_service
110  -mdns_service
111  -netd_service
112  -system_suspend_control_internal_service
113  -system_suspend_control_service
114  -tracingproxy_service
115  -virtual_touchpad_service
116  -vold_service
117  -default_android_service
118}:service_manager find;
119# suppress denials for services system_app should not be accessing.
120dontaudit system_app {
121  dnsresolver_service
122  dumpstate_service
123  installd_service
124  mdns_service
125  netd_service
126  virtual_touchpad_service
127  vold_service
128}:service_manager find;
129
130# suppress denials caused by debugfs_tracing
131dontaudit system_app debugfs_tracing:file rw_file_perms;
132
133# Ignore access to memory properties for Settings.
134dontaudit system_app proc_pagetypeinfo:file r_file_perms;
135dontaudit system_app sysfs_zram:dir search;
136
137allow system_app keystore:keystore2_key {
138    delete
139    get_info
140    grant
141    rebind
142    update
143    use
144};
145
146# Allow Settings to manage WI-FI keys.
147allow system_app wifi_key:keystore2_key {
148    delete
149    get_info
150    rebind
151    update
152    use
153};
154
155# settings app reads /proc/version
156allow system_app {
157  proc_version
158}:file r_file_perms;
159
160# Allow system apps to modify cgroup attributes and migrate processes
161allow system_app cgroup:file w_file_perms;
162allow system_app cgroup_v2:file w_file_perms;
163allow system_app cgroup_v2:dir w_dir_perms;
164
165control_logd(system_app)
166read_runtime_log_tags(system_app)
167get_prop(system_app, device_logging_prop)
168
169# allow system apps to use UDP sockets provided by the system server but not
170# modify them other than to connect
171allow system_app system_server:udp_socket {
172        connect getattr read recvfrom sendto write getopt setopt };
173
174# allow system apps to read game manager related sysrops
175get_prop(system_app, game_manager_config_prop)
176
177# Settings app reads ro.oem_unlock_supported
178get_prop(system_app, oem_unlock_prop)
179
180# Settings app reads ro.usb.uvc.enabled
181get_prop(system_app, usb_uvc_enabled_prop)
182
183# Settings app reads and writes the wifi blob database
184allow system_app connectivityblob_data_file:dir rw_dir_perms;
185allow system_app connectivityblob_data_file:file create_file_perms;
186
187###
188### Neverallow rules
189###
190
191# app domains which access /dev/fuse should not run as system_app
192neverallow system_app fuse_device:chr_file *;
193
194# Apps which run as UID=system should not rely on any attacker controlled
195# filesystem locations, such as /data/local/tmp. For /data/local/tmp, we
196# allow writes to files passed by file descriptor to support dumpstate and
197# bug reports, but not reads.
198neverallow system_app shell_data_file:dir { no_w_dir_perms open search read };
199neverallow system_app shell_data_file:file { open read ioctl lock };
200
201# system_app should be the only domain writing the adaptive haptics prop
202neverallow { domain -init -system_app } adaptive_haptics_prop:property_service set;
203# system_app should be the only domain writing the force l3 prop
204neverallow { domain -init -system_app } drm_forcel3_prop:property_service set;
205
206allow system_app vendor_boot_ota_file:dir { r_dir_perms };
207allow system_app vendor_boot_ota_file:file { r_file_perms };
208
209# allow system_app to read system_dlkm_file for /system_dlkm/etc/NOTICE.xml.gz
210allow system_app system_dlkm_file:dir search;
211allow system_app system_dlkm_file:file { getattr open read };
212