Stephen Smalley | b3cb969 | 2014-02-21 13:45:29 -0500 | [diff] [blame] | 1 | # Domain for shell processes spawned by ADB or console service. |
Stephen Smalley | 42fb824 | 2014-06-11 07:10:09 -0400 | [diff] [blame] | 2 | type shell, domain, mlstrustedsubject; |
Stephen Smalley | 0130154 | 2013-09-27 10:38:14 -0400 | [diff] [blame] | 3 | type shell_exec, exec_type, file_type; |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 4 | |
Stephen Smalley | 396015c | 2014-01-07 12:47:10 -0500 | [diff] [blame] | 5 | # Create and use network sockets. |
| 6 | net_domain(shell) |
| 7 | |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 8 | # Run app_process. |
Stephen Smalley | 712ca0a | 2013-10-23 13:25:53 -0400 | [diff] [blame] | 9 | # XXX Transition into its own domain? |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 10 | app_domain(shell) |
Stephen Smalley | d99e6d5 | 2013-12-02 14:18:11 -0500 | [diff] [blame] | 11 | |
Mark Salyzyn | ad5315d | 2014-03-17 13:00:38 -0700 | [diff] [blame] | 12 | # logd access |
| 13 | read_logd(shell) |
| 14 | control_logd(shell) |
| 15 | |
Nick Kralevich | 4fd4a20 | 2014-06-05 13:27:44 -0700 | [diff] [blame] | 16 | # read files in /data/anr |
| 17 | allow shell anr_data_file:dir r_dir_perms; |
| 18 | allow shell anr_data_file:file r_file_perms; |
| 19 | |
Stephen Smalley | 42fb824 | 2014-06-11 07:10:09 -0400 | [diff] [blame] | 20 | # Access /data/local/tmp. |
| 21 | allow shell shell_data_file:dir create_dir_perms; |
| 22 | allow shell shell_data_file:file create_file_perms; |
| 23 | allow shell shell_data_file:file rx_file_perms; |
| 24 | |
| 25 | # adb bugreport |
| 26 | unix_socket_connect(shell, dumpstate, dumpstate) |
| 27 | |
Stephen Smalley | 42fb824 | 2014-06-11 07:10:09 -0400 | [diff] [blame] | 28 | allow shell devpts:chr_file rw_file_perms; |
| 29 | allow shell tty_device:chr_file rw_file_perms; |
| 30 | allow shell console_device:chr_file rw_file_perms; |
Stephen Smalley | a2e4e26 | 2014-06-11 12:09:15 -0400 | [diff] [blame] | 31 | allow shell input_device:dir r_dir_perms; |
Stephen Smalley | 42fb824 | 2014-06-11 07:10:09 -0400 | [diff] [blame] | 32 | allow shell input_device:chr_file rw_file_perms; |
| 33 | allow shell system_file:file x_file_perms; |
| 34 | allow shell shell_exec:file rx_file_perms; |
| 35 | allow shell zygote_exec:file rx_file_perms; |
| 36 | |
| 37 | r_dir_file(shell, apk_data_file) |
| 38 | |
| 39 | # Set properties. |
| 40 | unix_socket_connect(shell, property, init) |
| 41 | allow shell shell_prop:property_service set; |
| 42 | allow shell ctl_dumpstate_prop:property_service set; |
| 43 | allow shell debug_prop:property_service set; |
| 44 | allow shell powerctl_prop:property_service set; |
| 45 | |
| 46 | # systrace support - allow atrace to run |
| 47 | # debugfs doesn't support labeling individual files, so we have |
| 48 | # to grant read access to all of /sys/kernel/debug. |
| 49 | # Directory read access and file write access is already granted |
| 50 | # in domain.te. |
| 51 | allow shell debugfs:file r_file_perms; |
| 52 | |
| 53 | # allow shell to run dmesg |
| 54 | allow shell kernel:system syslog_read; |