blob: 436af5a73f43524ce1f7216de1e36efdd3e48a91 [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)
Evan Rosky5cfdf2b2022-03-02 22:13:58 +000017get_prop(appdomain, persist_wm_debug_prop)
Inseob Kimdbcc4592020-05-21 20:12:55 +090018
Calin Juravle0b2ca6c2021-05-18 15:33:08 -070019# Allow ART to be configurable via device_config properties
20# (ART "runs" inside the app process)
21get_prop(appdomain, device_config_runtime_native_prop)
22get_prop(appdomain, device_config_runtime_native_boot_prop)
23
Florian Mayer5e522812019-10-08 16:15:14 +010024userdebug_or_eng(`perfetto_producer({ appdomain })')
25
Jeff Vander Stoep607bc672019-12-16 10:59:03 +010026# Prevent apps from causing presubmit failures.
27# Apps can cause selinux denials by accessing CE storage
28# and/or external storage. In either case, the selinux denial is
29# not the cause of the failure, but just a symptom that
30# storage isn't ready. Many apps handle the failure appropriately.
31#
32# Apps cannot access external storage before it becomes available.
33dontaudit appdomain storage_stub_file:dir getattr;
34# Attempts to write to system_data_file is generally a sign
35# that apps are attempting to access encrypted storage before
36# the ACTION_USER_UNLOCKED intent is delivered. Apps are not
37# allowed to write to CE storage before it's available.
38# Attempting to do so will be blocked by both selinux and unix
39# permissions.
40dontaudit appdomain system_data_file:dir write;
Jeff Vander Stoep67896ee2020-04-02 13:36:17 +020041# Apps should not be reading vendor-defined properties.
42dontaudit appdomain vendor_default_prop:file read;
Jeff Vander Stoep607bc672019-12-16 10:59:03 +010043
Zimb61bcc82021-04-08 12:20:26 +010044# Access to /mnt/media_rw/<vol> (limited by DAC to apps with external_storage gid)
Bram Bonneb93f26f2022-03-15 18:28:02 +010045allow { appdomain -sdk_sandbox } mnt_media_rw_file:dir search;
Zimb61bcc82021-04-08 12:20:26 +010046
Nathan Haroldee268642017-12-14 18:20:30 -080047neverallow appdomain system_server:udp_socket {
Nathan Harold252b0152018-03-27 06:34:54 -070048 accept append bind create ioctl listen lock name_bind
49 relabelfrom relabelto setattr shutdown };
Nick Kralevich1e5021c2018-11-28 17:50:24 -080050
51# Transition to a non-app domain.
52# Exception for the shell and su domains, can transition to runas, etc.
Nick Kralevich0eb0a162018-12-12 09:06:05 -080053# Exception for crash_dump to allow for app crash reporting.
54# Exception for renderscript binaries (/system/bin/bcc, /system/bin/ld.mc)
55# to allow renderscript to create privileged executable files.
56neverallow { appdomain -shell userdebug_or_eng(`-su') }
57 { domain -appdomain -crash_dump -rs }:process { transition };
58neverallow { appdomain -shell userdebug_or_eng(`-su') }
59 { domain -appdomain }:process { dyntransition };
Daniel Rosenbergafede842020-05-11 22:50:40 -070060
61# Don't allow regular apps access to storage configuration properties.
62neverallow { appdomain -mediaprovider_app } storage_config_prop:file no_rw_file_perms;
Peiyong Lin37dea072020-06-03 12:20:41 -070063
Inseob Kimc80b0242020-07-16 22:25:47 +090064# Allow to read sendbug.preferred.domain
65get_prop(appdomain, sendbug_config_prop)
66
Peiyong Lin37dea072020-06-03 12:20:41 -070067# Allow to read graphics related properties.
68get_prop(appdomain, graphics_config_prop)
Inseob Kimc97a97c2020-07-20 20:26:07 +090069
70# Allow to read persist.config.calibration_fac
71get_prop(appdomain, camera_calibration_prop)
Inseob Kim0cef0fe2020-11-17 13:54:52 +090072
73# Allow to read db.log.detailed, db.log.slow_query_threshold*
74get_prop(appdomain, sqlite_log_prop)
Orion Hodson8f75f762020-10-16 15:29:55 +010075
Seigo Nonaka9c3707f2021-01-21 13:08:31 -080076# Allow font file read by apps.
77allow appdomain font_data_file:file r_file_perms;
78allow appdomain font_data_file:dir r_dir_perms;
79
Martijn Coenen4825e862021-03-29 13:51:35 +020080# Enter /data/misc/apexdata/
81allow appdomain apex_module_data_file:dir search;
Orion Hodson13ee6532021-04-27 15:51:33 +010082# Read /data/misc/apexdata/com.android.art, execute signed AOT artifacts.
Martijn Coenen4825e862021-03-29 13:51:35 +020083allow appdomain apex_art_data_file:dir r_dir_perms;
Orion Hodson13ee6532021-04-27 15:51:33 +010084allow appdomain apex_art_data_file:file rx_file_perms;
Orion Hodson8f75f762020-10-16 15:29:55 +010085
Josh Gaoce1c4a52021-02-03 18:35:06 -080086# Allow access to tombstones if an fd to one is given to you.
87# This is restricted by unix permissions, so an app must go through system_server to get one.
88allow appdomain tombstone_data_file:file { getattr read };
89neverallow appdomain tombstone_data_file:file ~{ getattr read };
90
Nikita Ioffe269e7cf2022-01-13 22:56:14 +000091# WebView and other application-specific JIT compilers
92allow appdomain self:process execmem;
93
94allow appdomain { ashmem_device ashmem_libcutils_device }:chr_file execute;
95
96# Receive and use open file descriptors inherited from zygote.
97allow appdomain zygote:fd use;
98
99# Receive and use open file descriptors inherited from app zygote.
100allow appdomain app_zygote:fd use;
101
102# gdbserver for ndk-gdb reads the zygote.
103# valgrind needs mmap exec for zygote
104allow appdomain zygote_exec:file rx_file_perms;
105
106# Notify zygote of death;
107allow appdomain zygote:process sigchld;
108
109# Read /data/dalvik-cache.
110allow appdomain dalvikcache_data_file:dir { search getattr };
111allow appdomain dalvikcache_data_file:file r_file_perms;
112
113# Read the /sdcard and /mnt/sdcard symlinks
Bram Bonneb93f26f2022-03-15 18:28:02 +0100114allow { appdomain -isolated_app -sdk_sandbox } rootfs:lnk_file r_file_perms;
115allow { appdomain -isolated_app -sdk_sandbox } tmpfs:lnk_file r_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000116
117# Search /storage/emulated tmpfs mount.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100118allow { appdomain -sdk_sandbox } tmpfs:dir r_dir_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000119
120# Notify zygote of the wrapped process PID when using --invoke-with.
121allow appdomain zygote:fifo_file write;
122
123userdebug_or_eng(`
124 # Allow apps to create and write method traces in /data/misc/trace.
125 allow appdomain method_trace_data_file:dir w_dir_perms;
126 allow appdomain method_trace_data_file:file { create w_file_perms };
127')
128
129# Notify shell and adbd of death when spawned via runas for ndk-gdb.
130allow appdomain shell:process sigchld;
131allow appdomain adbd:process sigchld;
132
133# child shell or gdbserver pty access for runas.
134allow appdomain devpts:chr_file { getattr read write ioctl };
135
136# Use pipes and sockets provided by system_server via binder or local socket.
137allow appdomain system_server:fd use;
138allow appdomain system_server:fifo_file rw_file_perms;
139allow appdomain system_server:unix_stream_socket { read write setopt getattr getopt shutdown };
140allow appdomain system_server:tcp_socket { read write getattr getopt shutdown };
141
142# For AppFuse.
143allow appdomain vold:fd use;
144
145# Communication with other apps via fifos
146allow appdomain appdomain:fifo_file rw_file_perms;
147
148# Communicate with surfaceflinger.
149allow appdomain surfaceflinger:unix_stream_socket { read write setopt getattr getopt shutdown };
150
151# App sandbox file accesses.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100152allow { appdomain -isolated_app -mlstrustedsubject -sdk_sandbox } { app_data_file privapp_data_file }:dir create_dir_perms;
153allow { appdomain -isolated_app -mlstrustedsubject -sdk_sandbox } { app_data_file privapp_data_file }:file create_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000154
155# Access via already open fds is ok even for mlstrustedsubject.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100156allow { appdomain -isolated_app -sdk_sandbox } { app_data_file privapp_data_file system_app_data_file }:file { getattr map read write };
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000157
158# Traverse into expanded storage
159allow appdomain mnt_expand_file:dir r_dir_perms;
160
161# Keychain and user-trusted credentials
162r_dir_file(appdomain, keychain_data_file)
163allow appdomain misc_user_data_file:dir r_dir_perms;
164allow appdomain misc_user_data_file:file r_file_perms;
165
166# TextClassifier
167r_dir_file({ appdomain -isolated_app }, textclassifier_data_file)
168
169# Access to OEM provided data and apps
170allow appdomain oemfs:dir r_dir_perms;
171allow appdomain oemfs:file rx_file_perms;
172
173# Execute the shell or other system executables.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100174allow { appdomain -ephemeral_app -sdk_sandbox } shell_exec:file rx_file_perms;
175allow { appdomain -ephemeral_app -sdk_sandbox } toolbox_exec:file rx_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000176allow appdomain system_file:file x_file_perms;
Bram Bonneb93f26f2022-03-15 18:28:02 +0100177not_full_treble(`allow { appdomain -ephemeral_app -sdk_sandbox } vendor_file:file x_file_perms;')
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000178
179# Renderscript needs the ability to read directories on /system
180allow appdomain system_file:dir r_dir_perms;
181allow appdomain system_file:lnk_file { getattr open read };
182# Renderscript specific permissions to open /system/vendor/lib64.
183not_full_treble(`
184 allow appdomain vendor_file_type:dir r_dir_perms;
185 allow appdomain vendor_file_type:lnk_file { getattr open read };
186')
187
188full_treble_only(`
189 # For looking up Renderscript vendor drivers
190 allow { appdomain -isolated_app } vendor_file:dir { open read };
191')
192
193# Allow apps access to /vendor/app except for privileged
194# apps which cannot be in /vendor.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100195r_dir_file({ appdomain -ephemeral_app -sdk_sandbox }, vendor_app_file)
196allow { appdomain -ephemeral_app -sdk_sandbox } vendor_app_file:file execute;
197
198# Perform binder IPC to sdk sandbox.
199binder_call(appdomain, sdk_sandbox)
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000200
201# Allow apps access to /vendor/overlay
202r_dir_file(appdomain, vendor_overlay_file)
203
204# Allow apps access to /vendor/framework
205# for vendor provided libraries.
206r_dir_file(appdomain, vendor_framework_file)
207
208# Allow apps read / execute access to vendor public libraries.
209allow appdomain {vendor_public_framework_file vendor_public_lib_file}:dir r_dir_perms;
210allow appdomain {vendor_public_framework_file vendor_public_lib_file}:file { execute read open getattr map };
211
212# Read/write wallpaper file (opened by system).
213allow appdomain wallpaper_file:file { getattr read write map };
214
215# Read/write cached ringtones (opened by system).
216allow appdomain ringtone_file:file { getattr read write map };
217
218# Read ShortcutManager icon files (opened by system).
219allow appdomain shortcut_manager_icons:file { getattr read map };
220
221# Read icon file (opened by system).
222allow appdomain icon_file:file { getattr read map };
223
224# Old stack dumping scheme : append to a global trace file (/data/anr/traces.txt).
225#
226# TODO: All of these permissions except for anr_data_file:file append can be
227# withdrawn once we've switched to the new stack dumping mechanism, see b/32064548
228# and the rules below.
229allow appdomain anr_data_file:dir search;
230allow appdomain anr_data_file:file { open append };
231
232# New stack dumping scheme : request an output FD from tombstoned via a unix
233# domain socket.
234#
235# Allow apps to connect and write to the tombstoned java trace socket in
236# order to dump their traces. Also allow them to append traces to pipes
237# created by dumptrace. (Also see the rules below where they are given
238# additional permissions to dumpstate pipes for other aspects of bug report
239# creation).
240unix_socket_connect(appdomain, tombstoned_java_trace, tombstoned)
241allow appdomain tombstoned:fd use;
242allow appdomain dumpstate:fifo_file append;
243allow appdomain incidentd:fifo_file append;
244
245# Allow apps to send dump information to dumpstate
246allow appdomain dumpstate:fd use;
247allow appdomain dumpstate:unix_stream_socket { read write getopt getattr shutdown };
248allow appdomain dumpstate:fifo_file { write getattr };
249allow appdomain shell_data_file:file { write getattr };
250
251# Allow apps to send dump information to incidentd
252allow appdomain incidentd:fd use;
253allow appdomain incidentd:fifo_file { write getattr };
254
255# Allow apps to send information to statsd socket.
256unix_socket_send(appdomain, statsdw, statsd)
257
258# Write profiles /data/misc/profiles
259allow appdomain user_profile_root_file:dir search;
260allow appdomain user_profile_data_file:dir { search write add_name };
261allow appdomain user_profile_data_file:file create_file_perms;
262
263# Send heap dumps to system_server via an already open file descriptor
264# % adb shell am set-watch-heap com.android.systemui 1048576
265# % adb shell dumpsys procstats --start-testing
266# debuggable builds only.
267userdebug_or_eng(`
268 allow appdomain heapdump_data_file:file append;
269')
270
271# /proc/net access.
272# TODO(b/9496886) Audit access for removal.
273# proc_net access for the negated domains below is granted (or not) in their
274# individual .te files.
275r_dir_file({
276 appdomain
277 -ephemeral_app
278 -isolated_app
279 -platform_app
280 -priv_app
Bram Bonneb93f26f2022-03-15 18:28:02 +0100281 -sdk_sandbox
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000282 -shell
283 -system_app
284 -untrusted_app_all
285}, proc_net_type)
286# audit access for all these non-core app domains.
287userdebug_or_eng(`
288 auditallow {
289 appdomain
290 -ephemeral_app
291 -isolated_app
292 -platform_app
293 -priv_app
Bram Bonneb93f26f2022-03-15 18:28:02 +0100294 -sdk_sandbox
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000295 -shell
296 -su
297 -system_app
298 -untrusted_app_all
299 } proc_net_type:{ dir file lnk_file } { getattr open read };
300')
301
302# Grant GPU access to all processes started by Zygote.
303# They need that to render the standard UI.
304allow { appdomain -isolated_app } gpu_device:chr_file rw_file_perms;
305
306# Use the Binder.
307binder_use(appdomain)
308# Perform binder IPC to binder services.
309binder_call(appdomain, binderservicedomain)
310# Perform binder IPC to other apps.
311binder_call(appdomain, appdomain)
312# Perform binder IPC to ephemeral apps.
313binder_call(appdomain, ephemeral_app)
314# Perform binder IPC to gpuservice.
315binder_call({ appdomain -isolated_app }, gpuservice)
316
317# Talk with graphics composer fences
318allow appdomain hal_graphics_composer:fd use;
319
320# Already connected, unnamed sockets being passed over some other IPC
321# hence no sock_file or connectto permission. This appears to be how
322# Chrome works, may need to be updated as more apps using isolated services
323# are examined.
324allow appdomain appdomain:unix_stream_socket { getopt getattr read write shutdown };
325
326# Backup ability for every app. BMS opens and passes the fd
327# to any app that has backup ability. Hence, no open permissions here.
328allow appdomain backup_data_file:file { read write getattr map };
329allow appdomain cache_backup_file:file { read write getattr map };
330allow appdomain cache_backup_file:dir getattr;
331# Backup ability using 'adb backup'
332allow appdomain system_data_file:lnk_file r_file_perms;
333allow appdomain system_data_file:file { getattr read map };
334
335# Allow read/stat of /data/media files passed by Binder or local socket IPC.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100336allow { appdomain -isolated_app -sdk_sandbox } media_rw_data_file:file { read getattr };
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000337
338# Read and write /data/data/com.android.providers.telephony files passed over Binder.
339allow { appdomain -isolated_app } radio_data_file:file { read write getattr };
340
341# Allow access to external storage; we have several visible mount points under /storage
342# and symlinks to primary storage at places like /storage/sdcard0 and /mnt/user/0/primary
Bram Bonneb93f26f2022-03-15 18:28:02 +0100343allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } storage_file:dir r_dir_perms;
344allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } storage_file:lnk_file r_file_perms;
345allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } mnt_user_file:dir r_dir_perms;
346allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } mnt_user_file:lnk_file r_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000347
348# Read/write visible storage
Bram Bonneb93f26f2022-03-15 18:28:02 +0100349allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } { sdcard_type fuse }:dir create_dir_perms;
350allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } { sdcard_type fuse }:file create_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000351# This should be removed if sdcardfs is modified to alter the secontext for its
352# accesses to the underlying FS.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100353allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } media_rw_data_file:dir create_dir_perms;
354allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } media_rw_data_file:file create_file_perms;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000355
356# Allow apps to use the USB Accessory interface.
357# http://developer.android.com/guide/topics/connectivity/usb/accessory.html
358#
359# USB devices are first opened by the system server (USBDeviceManagerService)
360# and the file descriptor is passed to the right Activity via binder.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100361allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } usb_device:chr_file { read write getattr ioctl };
362allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } usbaccessory_device:chr_file { read write getattr };
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000363
364# For art.
365allow appdomain dalvikcache_data_file:file execute;
366allow appdomain dalvikcache_data_file:lnk_file r_file_perms;
367
368# Allow any app to read shared RELRO files.
369allow appdomain shared_relro_file:dir search;
370allow appdomain shared_relro_file:file r_file_perms;
371
372# Allow apps to read/execute installed binaries
373allow appdomain apk_data_file:dir r_dir_perms;
374allow appdomain apk_data_file:file rx_file_perms;
375
376# /data/resource-cache
377allow appdomain resourcecache_data_file:file r_file_perms;
378allow appdomain resourcecache_data_file:dir r_dir_perms;
379
380# logd access
381read_logd(appdomain)
Bram Bonneb93f26f2022-03-15 18:28:02 +0100382control_logd({ appdomain -ephemeral_app -sdk_sandbox })
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000383# application inherit logd write socket (urge is to deprecate this long term)
384allow appdomain zygote:unix_dgram_socket write;
385
Bram Bonneb93f26f2022-03-15 18:28:02 +0100386allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } keystore:keystore_key { get_state get insert delete exist list sign verify };
387allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } keystore:keystore2_key { delete use get_info rebind update };
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000388
Bram Bonneb93f26f2022-03-15 18:28:02 +0100389allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } keystore_maintenance_service:service_manager find;
390allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } keystore:keystore2 get_state;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000391
Bram Bonneb93f26f2022-03-15 18:28:02 +0100392use_keystore({ appdomain -isolated_app -ephemeral_app -sdk_sandbox })
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000393
Bram Bonneb93f26f2022-03-15 18:28:02 +0100394use_credstore({ appdomain -isolated_app -ephemeral_app -sdk_sandbox })
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000395
396allow appdomain console_device:chr_file { read write };
397
398# only allow unprivileged socket ioctl commands
399allowxperm { appdomain -bluetooth } self:{ rawip_socket tcp_socket udp_socket }
400 ioctl { unpriv_sock_ioctls unpriv_tty_ioctls };
401
402allow { appdomain -isolated_app } ion_device:chr_file r_file_perms;
403allow { appdomain -isolated_app } dmabuf_system_heap_device:chr_file r_file_perms;
404allow { appdomain -isolated_app } dmabuf_system_secure_heap_device:chr_file r_file_perms;
405
406# Allow AAudio apps to use shared memory file descriptors from the HAL
407allow { appdomain -isolated_app } hal_audio:fd use;
408
409# Allow app to access shared memory created by camera HAL1
410allow { appdomain -isolated_app } hal_camera:fd use;
411
412# Allow apps to access shared memory file descriptor from the tuner HAL
413allow {appdomain -isolated_app} hal_tv_tuner_server:fd use;
414
415# RenderScript always-passthrough HAL
416allow { appdomain -isolated_app } hal_renderscript_hwservice:hwservice_manager find;
417allow appdomain same_process_hal_file:file { execute read open getattr map };
418
419# TODO: switch to meminfo service
420allow appdomain proc_meminfo:file r_file_perms;
421
422# For app fuse.
423allow appdomain app_fuse_file:file { getattr read append write map };
424
Bram Bonneb93f26f2022-03-15 18:28:02 +0100425pdx_client({ appdomain -isolated_app -ephemeral_app -sdk_sandbox }, display_client)
426pdx_client({ appdomain -isolated_app -ephemeral_app -sdk_sandbox }, display_manager)
427pdx_client({ appdomain -isolated_app -ephemeral_app -sdk_sandbox }, display_vsync)
428pdx_client({ appdomain -isolated_app -ephemeral_app -sdk_sandbox }, performance_client)
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000429# Apps do not directly open the IPC socket for bufferhubd.
Bram Bonneb93f26f2022-03-15 18:28:02 +0100430pdx_use({ appdomain -isolated_app -ephemeral_app -sdk_sandbox }, bufferhub_client)
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000431
432###
433### CTS-specific rules
434###
435
436# For cts/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java.
437# testRunAsHasCorrectCapabilities
438allow appdomain runas_exec:file getattr;
439# Others are either allowed elsewhere or not desired.
440
441# Apps receive an open tun fd from the framework for
442# device traffic. Do not allow untrusted app to directly open tun_device
Bram Bonneb93f26f2022-03-15 18:28:02 +0100443allow { appdomain -isolated_app -ephemeral_app -sdk_sandbox } tun_device:chr_file { read write getattr append ioctl };
444allowxperm { appdomain -isolated_app -ephemeral_app -sdk_sandbox } tun_device:chr_file ioctl TUNGETIFF;
Nikita Ioffe269e7cf2022-01-13 22:56:14 +0000445
446# Connect to adbd and use a socket transferred from it.
447# This is used for e.g. adb backup/restore.
448allow appdomain adbd:unix_stream_socket connectto;
449allow appdomain adbd:fd use;
450allow appdomain adbd:unix_stream_socket { getattr getopt ioctl read write shutdown };
451
452allow appdomain cache_file:dir getattr;
453
454# Allow apps to run with asanwrapper.
455with_asan(`allow appdomain asanwrapper_exec:file rx_file_perms;')
456
457# Read access to FDs from the DropboxManagerService.
458allow appdomain dropbox_data_file:file { getattr read };
459
460# Read tmpfs types from these processes.
461allow appdomain audioserver_tmpfs:file { getattr map read write };
462allow appdomain system_server_tmpfs:file { getattr map read write };
463allow appdomain zygote_tmpfs:file { map read };
464
Orion Hodson8f75f762020-10-16 15:29:55 +0100465# Sensitive app domains are not allowed to execute from /data
466# to prevent persistence attacks and ensure all code is executed
467# from read-only locations.
468neverallow {
469 bluetooth
470 isolated_app
471 nfc
472 radio
Bram Bonneb93f26f2022-03-15 18:28:02 +0100473 sdk_sandbox
Orion Hodson8f75f762020-10-16 15:29:55 +0100474 shared_relro
475 system_app
476} {
477 data_file_type
478 -apex_art_data_file
479 -dalvikcache_data_file
480 -system_data_file # shared libs in apks
481 -apk_data_file
482}:file no_x_file_perms;
Tianjieb729aa62021-10-05 22:13:20 -0700483
484# For now, don't allow apps other than gmscore to access /data/misc_ce/<userid>/checkin
485neverallow { appdomain -gmscore_app } checkin_data_file:dir *;
486neverallow { appdomain -gmscore_app } checkin_data_file:file *;