Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 1 | typeattribute adbd coredomain; |
| 2 | typeattribute adbd mlstrustedsubject; |
| 3 | |
| 4 | init_daemon_domain(adbd) |
| 5 | |
| 6 | domain_auto_trans(adbd, shell_exec, shell) |
| 7 | |
| 8 | userdebug_or_eng(` |
| 9 | allow adbd self:process setcurrent; |
| 10 | allow adbd su:process dyntransition; |
| 11 | ') |
| 12 | |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 13 | # Do not sanitize the environment or open fds of the shell. Allow signaling |
| 14 | # created processes. |
| 15 | allow adbd shell:process { noatsecure signal }; |
| 16 | |
| 17 | # Set UID and GID to shell. Set supplementary groups. |
| 18 | allow adbd self:global_capability_class_set { setuid setgid }; |
| 19 | |
| 20 | # Drop capabilities from bounding set on user builds. |
| 21 | allow adbd self:global_capability_class_set setpcap; |
| 22 | |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 23 | # adbd probes for vsock support. Do not generate denials when |
| 24 | # this occurs. (b/123569840) |
| 25 | dontaudit adbd self:{ socket vsock_socket } create; |
| 26 | |
| 27 | # Allow adbd inside vm to forward vm's vsock. |
| 28 | allow adbd self:vsock_socket { create_socket_perms_no_ioctl listen accept }; |
| 29 | |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 30 | # Use a pseudo tty. |
| 31 | allow adbd devpts:chr_file rw_file_perms; |
| 32 | |
| 33 | # adb push/pull /data/local/tmp. |
| 34 | allow adbd shell_data_file:dir create_dir_perms; |
| 35 | allow adbd shell_data_file:file create_file_perms; |
| 36 | |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 37 | allow adbd tmpfs:dir search; |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 38 | |
| 39 | allow adbd rootfs:dir r_dir_perms; |
| 40 | |
Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 41 | # Connect to shell and use a socket transferred from it. |
| 42 | # Used for e.g. abb. |
| 43 | allow adbd shell:unix_stream_socket { read write shutdown }; |
| 44 | allow adbd shell:fd use; |