adbd.te 3.17 KB
Newer Older
Stephen Smalley's avatar
Stephen Smalley committed
1 2
# adbd seclabel is specified in init.rc since
# it lives in the rootfs and has no unique file type.
3
type adbd, domain, mlstrustedsubject;
4 5

userdebug_or_eng(`
6
  allow adbd self:process setcurrent;
7
  allow adbd su:process dyntransition;
8 9
')

10
domain_auto_trans(adbd, shell_exec, shell)
11

12 13 14
# Do not sanitize the environment or open fds of the shell. Allow signaling
# created processes.
allow adbd shell:process { noatsecure signal };
15 16 17 18

# Set UID and GID to shell.  Set supplementary groups.
allow adbd self:capability { setuid setgid };

Nick Kralevich's avatar
Nick Kralevich committed
19 20 21
# Drop capabilities from bounding set on user builds.
allow adbd self:capability setpcap;

22 23 24
# Create and use network sockets.
net_domain(adbd)

25
# Access /dev/android_adb or /dev/usb-ffs/adb/ep0
26
allow adbd adb_device:chr_file rw_file_perms;
27 28
allow adbd functionfs:dir search;
allow adbd functionfs:file rw_file_perms;
29 30 31 32 33

# Use a pseudo tty.
allow adbd devpts:chr_file rw_file_perms;

# adb push/pull /data/local/tmp.
34
allow adbd shell_data_file:dir create_dir_perms;
35 36 37
allow adbd shell_data_file:file create_file_perms;

# adb push/pull sdcard.
38 39
allow adbd tmpfs:dir search;
allow adbd rootfs:lnk_file r_file_perms;
40 41 42
allow adbd sdcard_type:dir create_dir_perms;
allow adbd sdcard_type:file create_file_perms;

43 44 45 46
# adb pull /data/anr/traces.txt
allow adbd anr_data_file:dir r_dir_perms;
allow adbd anr_data_file:file r_file_perms;

47
# Set service.adb.*, sys.powerctl, and sys.usb.ffs.ready properties.
48 49 50
set_prop(adbd, shell_prop)
set_prop(adbd, powerctl_prop)
set_prop(adbd, ffs_prop)
51

Nick Kralevich's avatar
Nick Kralevich committed
52
# Run /system/bin/bu
53 54
allow adbd system_file:file rx_file_perms;

55 56 57 58
# XXX Run toolbox.  Might not be needed.
allow adbd toolbox_exec:file rx_file_perms;
auditallow adbd toolbox_exec:file rx_file_perms;

59 60 61 62
# Perform binder IPC to surfaceflinger (screencap)
# XXX Run screencap in a separate domain?
binder_use(adbd)
binder_call(adbd, surfaceflinger)
dcashman's avatar
dcashman committed
63 64
# b/13188914
allow adbd gpu_device:chr_file rw_file_perms;
65
allow adbd ion_device:chr_file rw_file_perms;
66
r_dir_file(adbd, system_file)
67

68 69 70 71
# Read /data/misc/adb/adb_keys.
allow adbd adb_keys_file:dir search;
allow adbd adb_keys_file:file r_file_perms;

72 73 74 75 76 77 78 79
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;
')

80 81 82 83 84 85 86 87
# ndk-gdb invokes adb forward to forward the gdbserver socket.
allow adbd app_data_file:dir search;
allow adbd app_data_file:sock_file write;
allow adbd appdomain:unix_stream_socket connectto;

# 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;
88

89 90
allow adbd kernel:security read_policy;

91
allow adbd surfaceflinger_service:service_manager find;
92 93
allow adbd bootchart_data_file:dir search;
allow adbd bootchart_data_file:file r_file_perms;
94 95 96 97 98

# 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;
99
allow adbd mnt_user_file:dir r_dir_perms;
100
allow adbd mnt_user_file:lnk_file r_file_perms;