blob: 5fdd747baaf8b0e1335a0c9ba123dd367762b3d1 [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# adbd seclabel is specified in init.rc since
2# it lives in the rootfs and has no unique file type.
repo sync77d47312013-05-17 17:11:29 -07003type adbd, domain;
Nick Kralevich570e5f42014-01-11 00:25:01 -08004
5userdebug_or_eng(`
Stephen Smalley356f4be2014-05-23 11:26:19 -04006 allow adbd self:process setcurrent;
Nick Kralevich7d0f9552014-01-18 18:07:06 -08007 allow adbd su:process dyntransition;
Nick Kralevich570e5f42014-01-11 00:25:01 -08008')
9
Stephen Smalleyc83d0082012-03-07 14:59:01 -050010domain_auto_trans(adbd, shell_exec, shell)
Stephen Smalley55540752013-09-30 13:54:09 -040011
Stephen Smalley81e74b12014-01-02 15:46:39 -050012# Do not sanitize the environment or open fds of the shell.
13allow adbd shell:process noatsecure;
14
15# Set UID and GID to shell. Set supplementary groups.
16allow adbd self:capability { setuid setgid };
17
Nick Kralevich40ce0bb2014-01-11 14:11:45 -080018# Drop capabilities from bounding set on user builds.
19allow adbd self:capability setpcap;
20
Stephen Smalley81e74b12014-01-02 15:46:39 -050021# Create and use network sockets.
22net_domain(adbd)
23
Nick Kralevich77cc0552014-04-15 14:53:05 -070024# Access /dev/android_adb or /dev/usb-ffs/adb/ep0
Stephen Smalley81e74b12014-01-02 15:46:39 -050025allow adbd adb_device:chr_file rw_file_perms;
Nick Kralevich77cc0552014-04-15 14:53:05 -070026allow adbd functionfs:dir search;
27allow adbd functionfs:file rw_file_perms;
Stephen Smalley81e74b12014-01-02 15:46:39 -050028
Stephen Smalley81e74b12014-01-02 15:46:39 -050029# Use a pseudo tty.
30allow adbd devpts:chr_file rw_file_perms;
31
32# adb push/pull /data/local/tmp.
Nick Kralevich98b7ab52014-06-08 13:47:33 -070033allow adbd shell_data_file:dir create_dir_perms;
Stephen Smalley81e74b12014-01-02 15:46:39 -050034allow adbd shell_data_file:file create_file_perms;
35
36# adb push/pull sdcard.
37allow adbd sdcard_type:dir create_dir_perms;
38allow adbd sdcard_type:file create_file_perms;
39
Nick Kralevich4fd4a202014-06-05 13:27:44 -070040# adb pull /data/anr/traces.txt
41allow adbd anr_data_file:dir r_dir_perms;
42allow adbd anr_data_file:file r_file_perms;
43
Stephen Smalley81e74b12014-01-02 15:46:39 -050044# Set service.adb.*, sys.powerctl properties.
45unix_socket_connect(adbd, property, init)
46allow adbd shell_prop:property_service set;
47allow adbd powerctl_prop:property_service set;
48
Nick Kralevich24b56222014-02-05 14:06:26 -080049# Run /system/bin/bu
Stephen Smalley81e74b12014-01-02 15:46:39 -050050allow adbd system_file:file rx_file_perms;
Stephen Smalley81e74b12014-01-02 15:46:39 -050051
52# Perform binder IPC to surfaceflinger (screencap)
53# XXX Run screencap in a separate domain?
54binder_use(adbd)
55binder_call(adbd, surfaceflinger)
dcashmanddde8c22014-03-12 10:27:02 -070056# b/13188914
57allow adbd gpu_device:chr_file rw_file_perms;
Stephen Smalley81e74b12014-01-02 15:46:39 -050058
Stephen Smalley55540752013-09-30 13:54:09 -040059# Read /data/misc/adb/adb_keys.
60allow adbd adb_keys_file:dir search;
61allow adbd adb_keys_file:file r_file_perms;
62
Nick Kralevich7adc8cf2014-10-20 21:56:02 -070063userdebug_or_eng(`
64 # Write debugging information to /data/adb
65 # when persist.adb.trace_mask is set
66 # https://code.google.com/p/android/issues/detail?id=72895
67 allow adbd adb_data_file:dir rw_dir_perms;
68 allow adbd adb_data_file:file create_file_perms;
69')
70
Stephen Smalley48759ca2013-10-29 14:42:39 -040071# ndk-gdb invokes adb forward to forward the gdbserver socket.
72allow adbd app_data_file:dir search;
73allow adbd app_data_file:sock_file write;
74allow adbd appdomain:unix_stream_socket connectto;
75
Nick Kralevich2c38b3b2014-10-21 22:39:42 -070076# b/18078338 - allow read access to executable types on /system
77# to assist with debugging OTA issues.
78allow adbd exec_type:file r_file_perms;
79
Stephen Smalley48759ca2013-10-29 14:42:39 -040080# ndk-gdb invokes adb pull of app_process, linker, and libc.so.
81allow adbd zygote_exec:file r_file_perms;
82allow adbd system_file:file r_file_perms;
dcashman309cc662014-09-09 11:38:42 -070083
84allow adbd kernel:security read_policy;