blob: 9a703755870daf6a2daf05ae09b48d778c05837b [file] [log] [blame]
Alex Klyubinb5853c32017-01-05 17:18:32 -08001###
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
Alan Stokes81e4e872020-02-11 14:43:05 +00007typeattribute system_app coredomain, mlstrustedsubject;
Alex Klyubinb5853c32017-01-05 17:18:32 -08008
dcashman3e8dbf02016-12-08 11:23:34 -08009app_domain(system_app)
Alex Klyubinb5853c32017-01-05 17:18:32 -080010net_domain(system_app)
11binder_service(system_app)
12
Jeff Vander Stoepa12aad42017-07-10 20:39:50 -070013# android.ui and system.ui
14allow system_app rootfs:dir getattr;
15
Nick Kralevichc8ac7772024-06-07 10:17:37 -070016# read/write certain subdirectories of /data/data for system UID apps.
Alex Klyubinb5853c32017-01-05 17:18:32 -080017allow 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
Andrew Sapperstein544a9b12019-06-28 15:28:28 +000024# 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
Alex Klyubinb5853c32017-01-05 17:18:32 -080030# 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
Chris Pauload2f8832022-11-12 21:36:02 +000037set_prop(system_app, adaptive_haptics_prop)
Florian Mayer39f29f72021-12-21 12:06:31 -080038set_prop(system_app, arm64_memtag_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090039set_prop(system_app, bluetooth_a2dp_offload_prop)
Cheney Nie55a74b2019-03-18 11:07:32 +080040set_prop(system_app, bluetooth_audio_hal_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080041set_prop(system_app, bluetooth_prop)
42set_prop(system_app, debug_prop)
43set_prop(system_app, system_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090044set_prop(system_app, exported_bluetooth_prop)
Jaekyun Seoke4971452017-10-19 16:54:49 +090045set_prop(system_app, exported_system_prop)
Jaekyun Seoke4971452017-10-19 16:54:49 +090046set_prop(system_app, exported3_system_prop)
Super Liu078141a2021-12-13 09:57:20 +080047set_prop(system_app, gesture_prop)
Neil Fuller8fa264d2022-09-28 08:52:46 +000048set_prop(system_app, locale_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080049set_prop(system_app, logd_prop)
50set_prop(system_app, net_radio_prop)
Neil Fuller8fa264d2022-09-28 08:52:46 +000051set_prop(system_app, timezone_prop)
Inseob Kimdc1e5012020-04-27 21:13:01 +090052set_prop(system_app, usb_control_prop)
53set_prop(system_app, usb_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080054set_prop(system_app, log_tag_prop)
Kyle Zhang12c42b52023-09-28 21:10:17 +000055set_prop(system_app, drm_forcel3_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080056userdebug_or_eng(`set_prop(system_app, logpersistd_logging_prop)')
57auditallow system_app net_radio_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +090058auditallow system_app usb_control_prop:property_service set;
59auditallow system_app usb_prop:property_service set;
Hung-ying Tyan565384d2019-04-26 16:14:52 +080060# Allow Settings to enable Dynamic System Update
61set_prop(system_app, dynamic_system_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080062
63# ctl interface
64set_prop(system_app, ctl_default_prop)
65set_prop(system_app, ctl_bugreport_prop)
66
Howard Chen7833aa42020-03-19 18:58:11 +080067# Allow developer settings to query gsid status
68get_prop(system_app, gsid_prop)
69
Pawan Wagh60cc0b32023-08-29 00:09:29 +000070# Allow developer settings to check 16k pages boot option status
71get_prop(system_app, enable_16k_pages_prop)
72
Jaewan Kimc6a45d82025-01-02 16:27:32 +090073# Allow developer settings to check virtualization capabilities
74get_prop(system_app, hypervisor_prop)
75
Alex Klyubinb5853c32017-01-05 17:18:32 -080076# 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
Bookatz022ab0e2018-02-13 09:33:36 -080083# Allow system apps (like Settings) to interact with statsd
84binder_call(system_app, statsd)
85
Joe Onorato41f93db2016-11-20 23:23:04 -080086# Allow system apps to interact with incidentd
87binder_call(system_app, incidentd)
88
Pawan Waghc35c8af2023-09-20 00:05:07 +000089# 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
Rambo Wang8950e7a2020-02-12 19:06:04 -080095# Allow system app to interact with Dumpstate HAL
96hal_client_domain(system_app, hal_dumpstate)
97
Alex Klyubinb5853c32017-01-05 17:18:32 -080098allow system_app servicemanager:service_manager list;
99# TODO: scope this down? Too broad?
Dan Cashman91d398d2017-09-26 12:58:29 -0700100allow system_app {
101 service_manager_type
Martijn Coenenac097ac2018-08-17 09:35:42 +0200102 -apex_service
Luke Huang524f25e2019-02-25 20:12:15 +0800103 -dnsresolver_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700104 -dumpstate_service
105 -installd_service
Yifan Hong18ade862019-03-14 15:45:03 -0700106 -lpdump_service
paulhu70b0a772021-12-09 11:49:23 +0800107 -mdns_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700108 -netd_service
Michael Sun6445f192020-11-02 23:54:21 +0000109 -system_suspend_control_internal_service
Tri Vo131fa732019-02-07 13:29:39 -0800110 -system_suspend_control_service
Carmen Jacksona60d7f22021-06-23 16:53:45 -0700111 -tracingproxy_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700112 -virtual_touchpad_service
113 -vold_service
Steven Morelanda30464c2020-01-21 10:18:57 -0800114 -default_android_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700115}:service_manager find;
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700116# suppress denials for services system_app should not be accessing.
117dontaudit system_app {
Luke Huang524f25e2019-02-25 20:12:15 +0800118 dnsresolver_service
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700119 dumpstate_service
120 installd_service
paulhu70b0a772021-12-09 11:49:23 +0800121 mdns_service
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700122 netd_service
123 virtual_touchpad_service
124 vold_service
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700125}:service_manager find;
Alex Klyubinb5853c32017-01-05 17:18:32 -0800126
Adam Shih25437152020-12-07 16:30:29 +0800127# suppress denials caused by debugfs_tracing
128dontaudit system_app debugfs_tracing:file rw_file_perms;
129
ThiƩbaud Weksteenbdc72142023-11-23 10:40:07 +1100130# Ignore access to memory properties for Settings.
131dontaudit system_app proc_pagetypeinfo:file r_file_perms;
ThiƩbaud Weksteenbcc7cc12022-05-19 14:38:50 +1000132dontaudit system_app sysfs_zram:dir search;
133
Janis Danisevskisabb93f22020-07-27 12:53:20 -0700134allow system_app keystore:keystore2_key {
135 delete
136 get_info
137 grant
Janis Danisevskisabb93f22020-07-27 12:53:20 -0700138 rebind
139 update
140 use
141};
142
Janis Danisevskisdf31f202021-02-01 23:04:45 -0800143# Allow Settings to manage WI-FI keys.
144allow system_app wifi_key:keystore2_key {
145 delete
146 get_info
Janis Danisevskisdf31f202021-02-01 23:04:45 -0800147 rebind
148 update
149 use
150};
151
Tri Vo06d7dca2018-01-10 12:51:51 -0800152# settings app reads /proc/version
Jeff Vander Stoepc975bd92017-09-27 12:27:03 -0700153allow system_app {
Jeff Vander Stoepc975bd92017-09-27 12:27:03 -0700154 proc_version
155}:file r_file_perms;
Jeff Vander Stoepc15d54e2017-07-25 16:43:49 -0700156
T.J. Mercier12cefa52024-09-12 18:03:52 +0000157# Allow system apps to modify cgroup attributes and migrate processes
Tri Vof55c9892018-10-10 22:48:15 +0000158allow system_app cgroup:file w_file_perms;
Marco Ballesioaa4ce952021-02-11 15:18:11 -0800159allow system_app cgroup_v2:file w_file_perms;
Bart Van Asschebe3ff9b2022-01-31 21:33:29 +0000160allow system_app cgroup_v2:dir w_dir_perms;
Tri Vof55c9892018-10-10 22:48:15 +0000161
Alex Klyubinb5853c32017-01-05 17:18:32 -0800162control_logd(system_app)
Mark Salyzynd33a9a12016-11-07 15:11:39 -0800163read_runtime_log_tags(system_app)
Pavel Grafov118e4962018-01-18 17:22:28 +0000164get_prop(system_app, device_logging_prop)
Nick Kralevich45766d42017-04-26 11:40:48 -0700165
Nathan Haroldee268642017-12-14 18:20:30 -0800166# allow system apps to use UDP sockets provided by the system server but not
167# modify them other than to connect
Nathan Harold252b0152018-03-27 06:34:54 -0700168allow system_app system_server:udp_socket {
169 connect getattr read recvfrom sendto write getopt setopt };
Nathan Haroldee268642017-12-14 18:20:30 -0800170
Andy Yu43c7ab02023-12-07 16:59:30 -0800171# allow system apps to read game manager related sysrops
172get_prop(system_app, game_manager_config_prop)
173
Inseob Kimc80b0242020-07-16 22:25:47 +0900174# Settings app reads ro.oem_unlock_supported
175get_prop(system_app, oem_unlock_prop)
176
Avichal Rakesha12d3102023-01-23 23:46:42 -0800177# Settings app reads ro.usb.uvc.enabled
178get_prop(system_app, usb_uvc_enabled_prop)
179
Gabriel Biren22dd5d72024-03-06 00:52:57 +0000180# 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
Nick Kralevich45766d42017-04-26 11:40:48 -0700184###
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 *;
Nick Kralevich6e893ec2019-09-05 09:24:41 -0700190
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 };
Chris Pauload2f8832022-11-12 21:36:02 +0000197
198# system_app should be the only domain writing the adaptive haptics prop
199neverallow { domain -init -system_app } adaptive_haptics_prop:property_service set;
Kyle Zhangda5a09b2024-01-04 01:06:08 +0000200# system_app should be the only domain writing the force l3 prop
201neverallow { domain -init -system_app } drm_forcel3_prop:property_service set;
Pawan Waghb0718822024-04-29 22:03:20 +0000202
203allow system_app vendor_boot_ota_file:dir { r_dir_perms };
204allow system_app vendor_boot_ota_file:file { r_file_perms };
Ramji Jiyanief742642024-10-22 15:54:46 -0700205
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 };