2012-01-04 18:33:27 +01:00
|
|
|
# adbd seclabel is specified in init.rc since
|
|
|
|
# it lives in the rootfs and has no unique file type.
|
2015-11-28 04:18:17 +01:00
|
|
|
type adbd, domain, mlstrustedsubject;
|
2014-01-11 09:25:01 +01:00
|
|
|
|
|
|
|
userdebug_or_eng(`
|
2014-05-23 17:26:19 +02:00
|
|
|
allow adbd self:process setcurrent;
|
2014-01-19 03:07:06 +01:00
|
|
|
allow adbd su:process dyntransition;
|
2014-01-11 09:25:01 +01:00
|
|
|
')
|
|
|
|
|
2015-09-15 02:29:37 +02:00
|
|
|
# Do not sanitize the environment or open fds of the shell. Allow signaling
|
|
|
|
# created processes.
|
|
|
|
allow adbd shell:process { noatsecure signal };
|
2014-01-02 21:46:39 +01:00
|
|
|
|
|
|
|
# Set UID and GID to shell. Set supplementary groups.
|
|
|
|
allow adbd self:capability { setuid setgid };
|
|
|
|
|
2014-01-11 23:11:45 +01:00
|
|
|
# Drop capabilities from bounding set on user builds.
|
|
|
|
allow adbd self:capability setpcap;
|
|
|
|
|
2014-01-02 21:46:39 +01:00
|
|
|
# Create and use network sockets.
|
|
|
|
net_domain(adbd)
|
|
|
|
|
2014-04-15 23:53:05 +02:00
|
|
|
# Access /dev/android_adb or /dev/usb-ffs/adb/ep0
|
2014-01-02 21:46:39 +01:00
|
|
|
allow adbd adb_device:chr_file rw_file_perms;
|
2014-04-15 23:53:05 +02:00
|
|
|
allow adbd functionfs:dir search;
|
|
|
|
allow adbd functionfs:file rw_file_perms;
|
2014-01-02 21:46:39 +01:00
|
|
|
|
|
|
|
# Use a pseudo tty.
|
|
|
|
allow adbd devpts:chr_file rw_file_perms;
|
|
|
|
|
|
|
|
# adb push/pull /data/local/tmp.
|
2014-06-08 22:47:33 +02:00
|
|
|
allow adbd shell_data_file:dir create_dir_perms;
|
2014-01-02 21:46:39 +01:00
|
|
|
allow adbd shell_data_file:file create_file_perms;
|
|
|
|
|
2016-05-27 21:41:35 +02:00
|
|
|
# adb pull /data/misc/profman.
|
|
|
|
allow adbd profman_dump_data_file:dir r_dir_perms;
|
|
|
|
allow adbd profman_dump_data_file:file r_file_perms;
|
|
|
|
|
2014-01-02 21:46:39 +01:00
|
|
|
# adb push/pull sdcard.
|
2015-12-07 23:55:23 +01:00
|
|
|
allow adbd tmpfs:dir search;
|
2016-04-13 05:43:06 +02:00
|
|
|
allow adbd rootfs:lnk_file r_file_perms; # /sdcard symlink
|
|
|
|
allow adbd tmpfs:lnk_file r_file_perms; # /mnt/sdcard symlink
|
2014-01-02 21:46:39 +01:00
|
|
|
allow adbd sdcard_type:dir create_dir_perms;
|
|
|
|
allow adbd sdcard_type:file create_file_perms;
|
|
|
|
|
2014-06-05 22:27:44 +02:00
|
|
|
# adb pull /data/anr/traces.txt
|
|
|
|
allow adbd anr_data_file:dir r_dir_perms;
|
|
|
|
allow adbd anr_data_file:file r_file_perms;
|
|
|
|
|
2015-04-24 04:42:25 +02:00
|
|
|
# Set service.adb.*, sys.powerctl, and sys.usb.ffs.ready properties.
|
2015-05-05 03:22:45 +02:00
|
|
|
set_prop(adbd, shell_prop)
|
|
|
|
set_prop(adbd, powerctl_prop)
|
|
|
|
set_prop(adbd, ffs_prop)
|
2014-01-02 21:46:39 +01:00
|
|
|
|
2016-01-04 16:20:45 +01:00
|
|
|
# Access device logging gating property
|
|
|
|
get_prop(adbd, device_logging_prop)
|
|
|
|
|
2014-02-05 23:06:26 +01:00
|
|
|
# Run /system/bin/bu
|
2014-01-02 21:46:39 +01:00
|
|
|
allow adbd system_file:file rx_file_perms;
|
|
|
|
|
|
|
|
# Perform binder IPC to surfaceflinger (screencap)
|
|
|
|
# XXX Run screencap in a separate domain?
|
|
|
|
binder_use(adbd)
|
|
|
|
binder_call(adbd, surfaceflinger)
|
2014-03-12 18:27:02 +01:00
|
|
|
# b/13188914
|
|
|
|
allow adbd gpu_device:chr_file rw_file_perms;
|
2015-12-08 18:05:12 +01:00
|
|
|
allow adbd ion_device:chr_file rw_file_perms;
|
2015-12-08 00:48:57 +01:00
|
|
|
r_dir_file(adbd, system_file)
|
2014-01-02 21:46:39 +01:00
|
|
|
|
2013-09-30 19:54:09 +02:00
|
|
|
# Read /data/misc/adb/adb_keys.
|
|
|
|
allow adbd adb_keys_file:dir search;
|
|
|
|
allow adbd adb_keys_file:file r_file_perms;
|
|
|
|
|
2014-10-21 06:56:02 +02:00
|
|
|
userdebug_or_eng(`
|
|
|
|
# Write debugging information to /data/adb
|
|
|
|
# when persist.adb.trace_mask is set
|
|
|
|
# https://code.google.com/p/android/issues/detail?id=72895
|
|
|
|
allow adbd adb_data_file:dir rw_dir_perms;
|
|
|
|
allow adbd adb_data_file:file create_file_perms;
|
|
|
|
')
|
|
|
|
|
2013-10-29 19:42:39 +01:00
|
|
|
# ndk-gdb invokes adb forward to forward the gdbserver socket.
|
2016-10-06 22:15:44 +02:00
|
|
|
allow adbd { app_data_file ephemeral_data_file }:dir search;
|
|
|
|
allow adbd { app_data_file ephemeral_data_file }:sock_file write;
|
|
|
|
allow adbd { appdomain ephemeral_app }:unix_stream_socket connectto;
|
2013-10-29 19:42:39 +01:00
|
|
|
|
|
|
|
# ndk-gdb invokes adb pull of app_process, linker, and libc.so.
|
|
|
|
allow adbd zygote_exec:file r_file_perms;
|
|
|
|
allow adbd system_file:file r_file_perms;
|
2014-07-17 23:18:56 +02:00
|
|
|
|
2016-01-13 01:16:27 +01:00
|
|
|
# Allow pulling the SELinux policy for CTS purposes
|
|
|
|
allow adbd selinuxfs:dir r_dir_perms;
|
|
|
|
allow adbd selinuxfs:file r_file_perms;
|
2014-09-09 20:38:42 +02:00
|
|
|
allow adbd kernel:security read_policy;
|
|
|
|
|
2014-12-12 01:01:27 +01:00
|
|
|
allow adbd surfaceflinger_service:service_manager find;
|
2014-12-05 06:40:22 +01:00
|
|
|
allow adbd bootchart_data_file:dir search;
|
|
|
|
allow adbd bootchart_data_file:file r_file_perms;
|
2015-04-03 01:14:40 +02:00
|
|
|
|
|
|
|
# Allow access to external storage; we have several visible mount points under /storage
|
|
|
|
# and symlinks to primary storage at places like /storage/sdcard0 and /mnt/user/0/primary
|
|
|
|
allow adbd storage_file:dir r_dir_perms;
|
|
|
|
allow adbd storage_file:lnk_file r_file_perms;
|
2015-04-03 18:52:02 +02:00
|
|
|
allow adbd mnt_user_file:dir r_dir_perms;
|
2015-04-03 01:14:40 +02:00
|
|
|
allow adbd mnt_user_file:lnk_file r_file_perms;
|
2016-03-31 03:02:04 +02:00
|
|
|
|
|
|
|
# Access to /data/media.
|
2016-03-31 22:53:42 +02:00
|
|
|
# This should be removed if sdcardfs is modified to alter the secontext for its
|
|
|
|
# accesses to the underlying FS.
|
2016-03-31 03:02:04 +02:00
|
|
|
allow adbd media_rw_data_file:dir create_dir_perms;
|
|
|
|
allow adbd media_rw_data_file:file create_file_perms;
|
2016-04-08 00:13:14 +02:00
|
|
|
|
2016-07-19 21:42:57 +02:00
|
|
|
r_dir_file(adbd, apk_data_file)
|
|
|
|
|
2016-07-19 20:12:17 +02:00
|
|
|
allow adbd rootfs:dir r_dir_perms;
|
|
|
|
|
2016-04-07 23:04:41 +02:00
|
|
|
###
|
|
|
|
### Neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# No transitions from adbd to non-shell domains. adbd only ever
|
|
|
|
# transitions to the shell domain. In particular, we never want
|
|
|
|
# to see a transition from adbd to su (aka "adb root")
|
|
|
|
neverallow adbd { domain -shell }:process transition;
|
|
|
|
neverallow adbd { domain userdebug_or_eng(`-su') }:process dyntransition;
|