Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute shell coredomain; |
| 2 | |
Siarhei Vishniakou | 2a7f571 | 2017-05-10 19:37:06 -0700 | [diff] [blame] | 3 | # allow shell input injection |
| 4 | allow shell uhid_device:chr_file rw_file_perms; |
| 5 | |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 6 | # systrace support - allow atrace to run |
Carmen Jackson | 2c8ca45 | 2018-01-30 18:14:45 -0800 | [diff] [blame] | 7 | allow shell debugfs_tracing_debug:dir r_dir_perms; |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 8 | allow shell debugfs_tracing:dir r_dir_perms; |
Joel Galenson | 27c0aa7 | 2017-07-26 16:22:50 -0700 | [diff] [blame] | 9 | allow shell debugfs_tracing:file rw_file_perms; |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 10 | allow shell debugfs_trace_marker:file getattr; |
| 11 | allow shell atrace_exec:file rx_file_perms; |
| 12 | |
Carmen Jackson | 25788df | 2017-04-14 12:12:50 -0700 | [diff] [blame] | 13 | userdebug_or_eng(` |
Joel Galenson | 47966ce | 2017-07-27 09:50:25 -0700 | [diff] [blame] | 14 | allow shell debugfs_tracing_debug:file rw_file_perms; |
Carmen Jackson | 25788df | 2017-04-14 12:12:50 -0700 | [diff] [blame] | 15 | ') |
| 16 | |
Carmen Jackson | 2c8ca45 | 2018-01-30 18:14:45 -0800 | [diff] [blame] | 17 | # read config.gz for CTS purposes |
| 18 | allow shell config_gz:file r_file_perms; |
| 19 | |
dcashman | 3e8dbf0 | 2016-12-08 11:23:34 -0800 | [diff] [blame] | 20 | # Run app_process. |
| 21 | # XXX Transition into its own domain? |
| 22 | app_domain(shell) |
Jin Qian | a239f30 | 2017-03-23 12:28:20 -0700 | [diff] [blame] | 23 | |
| 24 | # allow shell to call dumpsys storaged |
| 25 | binder_call(shell, storaged) |
Nick Kralevich | 14e2e92 | 2017-05-08 09:51:59 -0700 | [diff] [blame] | 26 | |
| 27 | # Perform SELinux access checks, needed for CTS |
| 28 | selinux_check_access(shell) |
| 29 | selinux_check_context(shell) |
Primiano Tucci | c80f9e0 | 2017-12-21 03:51:15 +0100 | [diff] [blame] | 30 | |
| 31 | # Control Perfetto traced and obtain traces from it. |
| 32 | # Needed for Studio and debugging. |
| 33 | unix_socket_connect(shell, traced_consumer, traced) |
| 34 | |
| 35 | # Allow shell binaries to write trace data to Perfetto. Used for testing and |
| 36 | # cmdline utils. |
Florian Mayer | 5e52281 | 2019-10-08 16:15:14 +0100 | [diff] [blame] | 37 | perfetto_producer(shell) |
Yifan Hong | 00ab5d8 | 2018-01-11 11:01:30 -0800 | [diff] [blame] | 38 | |
| 39 | domain_auto_trans(shell, vendor_shell_exec, vendor_shell) |
Primiano Tucci | 1a9f4f7 | 2018-01-24 16:07:09 +0000 | [diff] [blame] | 40 | |
| 41 | # Allow shell binaries to exec the perfetto cmdline util and have that |
| 42 | # transition into its own domain, so that it behaves consistently to |
| 43 | # when exec()-d by statsd. |
| 44 | domain_auto_trans(shell, perfetto_exec, perfetto) |
Florian Mayer | aeca04b | 2018-12-06 13:28:01 +0000 | [diff] [blame] | 45 | # Allow to send SIGINT to perfetto when daemonized. |
| 46 | allow shell perfetto:process signal; |
Primiano Tucci | 1a9f4f7 | 2018-01-24 16:07:09 +0000 | [diff] [blame] | 47 | |
Bookatz | 022ab0e | 2018-02-13 09:33:36 -0800 | [diff] [blame] | 48 | # Allow shell to run adb shell cmd stats commands. Needed for CTS. |
| 49 | binder_call(shell, statsd); |
| 50 | |
Primiano Tucci | 1a9f4f7 | 2018-01-24 16:07:09 +0000 | [diff] [blame] | 51 | # Allow shell to read and unlink traces stored in /data/misc/perfetto-traces. |
| 52 | allow shell perfetto_traces_data_file:dir rw_dir_perms; |
Florian Mayer | c069bc1 | 2019-09-30 11:09:45 +0100 | [diff] [blame] | 53 | allow shell perfetto_traces_data_file:file { r_file_perms unlink }; |
Fan Xu | 26fa914 | 2018-09-17 17:06:19 -0700 | [diff] [blame] | 54 | |
Yiwei Zhang | ff0f79c | 2018-11-27 15:21:43 -0800 | [diff] [blame] | 55 | # Allow shell to run adb shell cmd gpu commands. |
| 56 | binder_call(shell, gpuservice); |
| 57 | |
Wei Wang | bc71a61 | 2018-09-19 16:06:28 -0700 | [diff] [blame] | 58 | # Allow shell to use atrace HAL |
| 59 | hal_client_domain(shell, hal_atrace) |
Jeff Vander Stoep | 4245177 | 2018-09-28 10:55:14 -0700 | [diff] [blame] | 60 | |
| 61 | # For hostside tests such as CTS listening ports test. |
| 62 | allow shell proc_net_tcp_udp:file r_file_perms; |
Nick Kralevich | 905b400 | 2019-02-25 15:11:40 -0800 | [diff] [blame] | 63 | |
| 64 | # The dl.exec_linker* tests need to execute /system/bin/linker |
| 65 | # b/124789393 |
| 66 | allow shell system_linker_exec:file rx_file_perms; |
Nick Kralevich | 68e27ca | 2019-02-26 12:30:42 -0800 | [diff] [blame] | 67 | |
| 68 | # Renderscript host side tests depend on being able to execute |
| 69 | # /system/bin/bcc (b/126388046) |
| 70 | allow shell rs_exec:file rx_file_perms; |
Yifan Hong | 18ade86 | 2019-03-14 15:45:03 -0700 | [diff] [blame] | 71 | |
| 72 | # Allow shell to start and comminicate with lpdumpd. |
| 73 | set_prop(shell, lpdumpd_prop); |
| 74 | binder_call(shell, lpdumpd) |
Kiyoung Kim | 82c87ed | 2019-08-09 14:20:34 +0900 | [diff] [blame] | 75 | |
Eric Biggers | b57af5d | 2019-09-27 13:33:27 -0700 | [diff] [blame] | 76 | # Allow shell to get encryption policy of /data/local/tmp/, for CTS |
| 77 | allowxperm shell shell_data_file:dir ioctl { |
| 78 | FS_IOC_GET_ENCRYPTION_POLICY |
| 79 | FS_IOC_GET_ENCRYPTION_POLICY_EX |
| 80 | }; |
Ryan Savitski | ffa0dd9 | 2020-01-10 19:02:43 +0000 | [diff] [blame] | 81 | |
| 82 | # Allow shell to execute simpleperf without a domain transition. |
| 83 | allow shell simpleperf_exec:file rx_file_perms; |
| 84 | |
| 85 | # Allow shell to call perf_event_open for profiling other shell processes, but |
| 86 | # not the whole system. |
| 87 | allow shell self:perf_event { open read write kernel }; |
| 88 | neverallow shell self:perf_event ~{ open read write kernel }; |