2015-10-05 18:15:04 +02:00
|
|
|
###
|
|
|
|
### A domain for further sandboxing privileged apps.
|
|
|
|
###
|
2015-11-03 18:54:39 +01:00
|
|
|
type priv_app, domain, domain_deprecated;
|
2015-10-05 18:15:04 +02:00
|
|
|
app_domain(priv_app)
|
|
|
|
# Access the network.
|
|
|
|
net_domain(priv_app)
|
|
|
|
# Access bluetooth.
|
|
|
|
bluetooth_domain(priv_app)
|
|
|
|
|
2016-03-16 20:55:42 +01:00
|
|
|
# webview crash handling depends on self ptrace (b/27697529, b/20150694, b/19277529#comment7)
|
|
|
|
allow priv_app self:process ptrace;
|
|
|
|
|
2015-10-05 18:15:04 +02:00
|
|
|
# Some apps ship with shared libraries and binaries that they write out
|
|
|
|
# to their sandbox directory and then execute.
|
|
|
|
allow priv_app app_data_file:file rx_file_perms;
|
|
|
|
|
2015-10-19 22:07:15 +02:00
|
|
|
# android.process.media uses /dev/mtp_usb
|
|
|
|
allow priv_app mtp_device:chr_file rw_file_perms;
|
|
|
|
|
2015-10-05 18:15:04 +02:00
|
|
|
# Allow the allocation and use of ptys
|
|
|
|
# Used by: https://play.privileged.com/store/apps/details?id=jackpal.androidterm
|
|
|
|
create_pty(priv_app)
|
|
|
|
|
2015-09-09 19:48:04 +02:00
|
|
|
allow priv_app audioserver_service:service_manager find;
|
2015-12-04 01:10:05 +01:00
|
|
|
allow priv_app cameraserver_service:service_manager find;
|
2015-10-05 18:15:04 +02:00
|
|
|
allow priv_app drmserver_service:service_manager find;
|
2016-02-03 01:10:37 +01:00
|
|
|
allow priv_app mediacodec_service:service_manager find;
|
2016-03-09 19:14:56 +01:00
|
|
|
allow priv_app mediadrmserver_service:service_manager find;
|
|
|
|
allow priv_app mediaextractor_service:service_manager find;
|
|
|
|
allow priv_app mediaserver_service:service_manager find;
|
2015-10-05 18:15:04 +02:00
|
|
|
allow priv_app nfc_service:service_manager find;
|
|
|
|
allow priv_app radio_service:service_manager find;
|
|
|
|
allow priv_app surfaceflinger_service:service_manager find;
|
|
|
|
allow priv_app app_api_service:service_manager find;
|
|
|
|
allow priv_app system_api_service:service_manager find;
|
|
|
|
allow priv_app persistent_data_block_service:service_manager find;
|
2016-02-03 21:43:58 +01:00
|
|
|
allow priv_app recovery_service:service_manager find;
|
2016-02-14 09:14:21 +01:00
|
|
|
allow priv_app contexthub_service:service_manager find;
|
2015-10-05 18:15:04 +02:00
|
|
|
|
|
|
|
# Traverse into /mnt/media_rw for bypassing FUSE daemon
|
|
|
|
# TODO: narrow this to just MediaProvider
|
|
|
|
allow priv_app mnt_media_rw_file:dir search;
|
|
|
|
|
2015-10-16 00:14:08 +02:00
|
|
|
# Write to /cache.
|
2015-12-22 21:37:17 +01:00
|
|
|
allow priv_app { cache_file cache_recovery_file }:dir create_dir_perms;
|
|
|
|
allow priv_app { cache_file cache_recovery_file }:file create_file_perms;
|
|
|
|
|
2015-10-05 18:15:04 +02:00
|
|
|
# Access to /data/media.
|
|
|
|
allow priv_app media_rw_data_file:dir create_dir_perms;
|
|
|
|
allow priv_app media_rw_data_file:file create_file_perms;
|
|
|
|
|
|
|
|
# Used by Finsky / Android "Verify Apps" functionality when
|
|
|
|
# running "adb install foo.apk".
|
|
|
|
allow priv_app shell_data_file:file r_file_perms;
|
|
|
|
allow priv_app shell_data_file:dir r_dir_perms;
|
|
|
|
|
2015-10-19 18:24:04 +02:00
|
|
|
# Allow verifier to access staged apks.
|
|
|
|
allow priv_app { apk_tmp_file apk_private_tmp_file }:dir r_dir_perms;
|
|
|
|
allow priv_app { apk_tmp_file apk_private_tmp_file }:file r_file_perms;
|
|
|
|
|
2015-10-05 18:15:04 +02:00
|
|
|
# b/18504118: Allow reads from /data/anr/traces.txt
|
|
|
|
allow priv_app anr_data_file:file r_file_perms;
|
|
|
|
|
|
|
|
# Allow GMS core to access perfprofd output, which is stored
|
|
|
|
# in /data/misc/perfprofd/. GMS core will need to list all
|
|
|
|
# data stored in that directory to process them one by one.
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow priv_app perfprofd_data_file:file r_file_perms;
|
|
|
|
allow priv_app perfprofd_data_file:dir r_dir_perms;
|
|
|
|
')
|
|
|
|
|
2015-12-03 20:16:20 +01:00
|
|
|
# Allow GMS core to stat files and executables on
|
|
|
|
# the system partition
|
|
|
|
allow priv_app exec_type:file getattr;
|
|
|
|
|
2015-12-02 05:43:46 +01:00
|
|
|
# For AppFuse.
|
|
|
|
allow priv_app vold:fd use;
|
|
|
|
allow priv_app fuse_device:chr_file { read write };
|
2016-01-28 07:48:39 +01:00
|
|
|
allow priv_app app_fuse_file:dir rw_dir_perms;
|
|
|
|
allow priv_app app_fuse_file:file rw_file_perms;
|
2015-12-02 05:43:46 +01:00
|
|
|
|
2016-01-04 23:23:23 +01:00
|
|
|
# /sys access
|
|
|
|
allow priv_app sysfs_zram:dir search;
|
|
|
|
allow priv_app sysfs_zram:file r_file_perms;
|
|
|
|
|
2016-01-06 19:09:02 +01:00
|
|
|
# access the mac address
|
|
|
|
allowxperm priv_app self:udp_socket ioctl SIOCGIFHWADDR;
|
|
|
|
|
2016-01-26 01:41:03 +01:00
|
|
|
# Allow GMS core to communicate with update_engine for A/B update.
|
|
|
|
binder_call(priv_app, update_engine)
|
|
|
|
allow priv_app update_engine_service:service_manager find;
|
|
|
|
|
2016-03-02 02:00:56 +01:00
|
|
|
# Allow Phone to read/write cached ringtones (opened by system).
|
|
|
|
allow priv_app ringtone_file:file { getattr read write };
|
|
|
|
|
2015-10-05 18:15:04 +02:00
|
|
|
###
|
|
|
|
### neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# Receive or send uevent messages.
|
|
|
|
neverallow priv_app domain:netlink_kobject_uevent_socket *;
|
|
|
|
|
|
|
|
# Receive or send generic netlink messages
|
|
|
|
neverallow priv_app domain:netlink_socket *;
|
|
|
|
|
|
|
|
# Too much leaky information in debugfs. It's a security
|
|
|
|
# best practice to ensure these files aren't readable.
|
|
|
|
neverallow priv_app debugfs:file read;
|
|
|
|
|
|
|
|
# Do not allow privileged apps to register services.
|
|
|
|
# Only trusted components of Android should be registering
|
|
|
|
# services.
|
|
|
|
neverallow priv_app service_manager_type:service_manager add;
|
|
|
|
|
|
|
|
# Do not allow privileged apps to connect to the property service
|
|
|
|
# or set properties. b/10243159
|
|
|
|
neverallow priv_app property_socket:sock_file write;
|
|
|
|
neverallow priv_app init:unix_stream_socket connectto;
|
|
|
|
neverallow priv_app property_type:property_service set;
|
|
|
|
|
|
|
|
# Do not allow priv_app to be assigned mlstrustedsubject.
|
|
|
|
# This would undermine the per-user isolation model being
|
|
|
|
# enforced via levelFrom=user in seapp_contexts and the mls
|
|
|
|
# constraints. As there is no direct way to specify a neverallow
|
|
|
|
# on attribute assignment, this relies on the fact that fork
|
|
|
|
# permission only makes sense within a domain (hence should
|
|
|
|
# never be granted to any other domain within mlstrustedsubject)
|
|
|
|
# and priv_app is allowed fork permission to itself.
|
|
|
|
neverallow priv_app mlstrustedsubject:process fork;
|
|
|
|
|
|
|
|
# Do not allow priv_app to hard link to any files.
|
|
|
|
# In particular, if priv_app links to other app data
|
|
|
|
# files, installd will not be able to guarantee the deletion
|
|
|
|
# of the linked to file. Hard links also contribute to security
|
|
|
|
# bugs, so we want to ensure priv_app never has this
|
|
|
|
# capability.
|
|
|
|
neverallow priv_app file_type:file link;
|