blob: 2a2af0ffb48551af3c77abaf36df925f81097132 [file] [log] [blame]
Inseob Kim55e5c9b2020-03-04 17:20:35 +09001
Alex Klyubinf5446eb2017-03-23 14:27:32 -07002typeattribute shell coredomain;
3
Siarhei Vishniakou2a7f5712017-05-10 19:37:06 -07004# allow shell input injection
5allow shell uhid_device:chr_file rw_file_perms;
6
dcashman2e00e632016-10-12 14:58:09 -07007# systrace support - allow atrace to run
Carmen Jackson2c8ca452018-01-30 18:14:45 -08008allow shell debugfs_tracing_debug:dir r_dir_perms;
dcashman2e00e632016-10-12 14:58:09 -07009allow shell debugfs_tracing:dir r_dir_perms;
Joel Galenson27c0aa72017-07-26 16:22:50 -070010allow shell debugfs_tracing:file rw_file_perms;
dcashman2e00e632016-10-12 14:58:09 -070011allow shell debugfs_trace_marker:file getattr;
12allow shell atrace_exec:file rx_file_perms;
13
Carmen Jackson25788df2017-04-14 12:12:50 -070014userdebug_or_eng(`
Joel Galenson47966ce2017-07-27 09:50:25 -070015 allow shell debugfs_tracing_debug:file rw_file_perms;
Carmen Jackson25788df2017-04-14 12:12:50 -070016')
17
Carmen Jackson2c8ca452018-01-30 18:14:45 -080018# read config.gz for CTS purposes
19allow shell config_gz:file r_file_perms;
20
dcashman3e8dbf02016-12-08 11:23:34 -080021# Run app_process.
22# XXX Transition into its own domain?
23app_domain(shell)
Jin Qiana239f302017-03-23 12:28:20 -070024
25# allow shell to call dumpsys storaged
26binder_call(shell, storaged)
Nick Kralevich14e2e922017-05-08 09:51:59 -070027
28# Perform SELinux access checks, needed for CTS
29selinux_check_access(shell)
30selinux_check_context(shell)
Primiano Tuccic80f9e02017-12-21 03:51:15 +010031
32# Control Perfetto traced and obtain traces from it.
33# Needed for Studio and debugging.
34unix_socket_connect(shell, traced_consumer, traced)
35
36# Allow shell binaries to write trace data to Perfetto. Used for testing and
37# cmdline utils.
Florian Mayer5e522812019-10-08 16:15:14 +010038perfetto_producer(shell)
Yifan Hong00ab5d82018-01-11 11:01:30 -080039
40domain_auto_trans(shell, vendor_shell_exec, vendor_shell)
Primiano Tucci1a9f4f72018-01-24 16:07:09 +000041
42# Allow shell binaries to exec the perfetto cmdline util and have that
43# transition into its own domain, so that it behaves consistently to
44# when exec()-d by statsd.
45domain_auto_trans(shell, perfetto_exec, perfetto)
Florian Mayeraeca04b2018-12-06 13:28:01 +000046# Allow to send SIGINT to perfetto when daemonized.
47allow shell perfetto:process signal;
Primiano Tucci1a9f4f72018-01-24 16:07:09 +000048
Bookatz022ab0e2018-02-13 09:33:36 -080049# Allow shell to run adb shell cmd stats commands. Needed for CTS.
50binder_call(shell, statsd);
51
Primiano Tucci1a9f4f72018-01-24 16:07:09 +000052# Allow shell to read and unlink traces stored in /data/misc/perfetto-traces.
53allow shell perfetto_traces_data_file:dir rw_dir_perms;
Florian Mayerc069bc12019-09-30 11:09:45 +010054allow shell perfetto_traces_data_file:file { r_file_perms unlink };
Fan Xu26fa9142018-09-17 17:06:19 -070055
Yiwei Zhangff0f79c2018-11-27 15:21:43 -080056# Allow shell to run adb shell cmd gpu commands.
57binder_call(shell, gpuservice);
58
Wei Wangbc71a612018-09-19 16:06:28 -070059# Allow shell to use atrace HAL
60hal_client_domain(shell, hal_atrace)
Jeff Vander Stoep42451772018-09-28 10:55:14 -070061
62# For hostside tests such as CTS listening ports test.
63allow shell proc_net_tcp_udp:file r_file_perms;
Nick Kralevich905b4002019-02-25 15:11:40 -080064
65# The dl.exec_linker* tests need to execute /system/bin/linker
66# b/124789393
67allow shell system_linker_exec:file rx_file_perms;
Nick Kralevich68e27ca2019-02-26 12:30:42 -080068
69# Renderscript host side tests depend on being able to execute
70# /system/bin/bcc (b/126388046)
71allow shell rs_exec:file rx_file_perms;
Yifan Hong18ade862019-03-14 15:45:03 -070072
73# Allow shell to start and comminicate with lpdumpd.
74set_prop(shell, lpdumpd_prop);
75binder_call(shell, lpdumpd)
Kiyoung Kim82c87ed2019-08-09 14:20:34 +090076
Nikita Ioffe91c37952020-03-12 14:45:00 +000077# Allow shell to set and read value of properties used for CTS tests of
78# userspace reboot
79set_prop(shell, userspace_reboot_test_prop)
80
Eric Biggersb57af5d2019-09-27 13:33:27 -070081# Allow shell to get encryption policy of /data/local/tmp/, for CTS
82allowxperm shell shell_data_file:dir ioctl {
83 FS_IOC_GET_ENCRYPTION_POLICY
84 FS_IOC_GET_ENCRYPTION_POLICY_EX
85};
Ryan Savitskiffa0dd92020-01-10 19:02:43 +000086
87# Allow shell to execute simpleperf without a domain transition.
88allow shell simpleperf_exec:file rx_file_perms;
89
90# Allow shell to call perf_event_open for profiling other shell processes, but
91# not the whole system.
92allow shell self:perf_event { open read write kernel };
93neverallow shell self:perf_event ~{ open read write kernel };
Inseob Kim55e5c9b2020-03-04 17:20:35 +090094
95# Set properties.
96set_prop(shell, shell_prop)
97set_prop(shell, ctl_bugreport_prop)
98set_prop(shell, ctl_dumpstate_prop)
99set_prop(shell, dumpstate_prop)
100set_prop(shell, exported_dumpstate_prop)
101set_prop(shell, debug_prop)
102set_prop(shell, powerctl_prop)
103set_prop(shell, log_tag_prop)
104set_prop(shell, wifi_log_prop)
105# Allow shell to start/stop traced via the persist.traced.enable
106# property (which also takes care of /data/misc initialization).
107set_prop(shell, traced_enabled_prop)
108# adjust is_loggable properties
109userdebug_or_eng(`set_prop(shell, log_prop)')
110# logpersist script
111userdebug_or_eng(`set_prop(shell, logpersistd_logging_prop)')
112# Allow shell to start/stop heapprofd via the persist.heapprofd.enable
113# property.
114set_prop(shell, heapprofd_enabled_prop)
115# Allow shell to start/stop traced_perf via the persist.traced_perf.enable
116# property.
117set_prop(shell, traced_perf_enabled_prop)
118# Allow shell to start/stop gsid via ctl.start|stop|restart gsid.
119set_prop(shell, ctl_gsid_prop)
120# Allow shell to enable Dynamic System Update
121set_prop(shell, dynamic_system_prop)
122# Allow shell to mock an OTA using persist.pm.mock-upgrade
123set_prop(shell, mock_ota_prop)
124
125# Read device's serial number from system properties
126get_prop(shell, serialno_prop)
127
128# Allow shell to read the vendor security patch level for CTS
129get_prop(shell, vendor_security_patch_level_prop)
130
131# Read state of logging-related properties
132get_prop(shell, device_logging_prop)
133
134# Read state of boot reason properties
135get_prop(shell, bootloader_boot_reason_prop)
136get_prop(shell, last_boot_reason_prop)
137get_prop(shell, system_boot_reason_prop)
138
139# Allow reading the outcome of perf_event_open LSM support test for CTS.
140get_prop(shell, init_perf_lsm_hooks_prop)
141
142userdebug_or_eng(`set_prop(shell, persist_debug_prop)')
Peiyong Lin37dea072020-06-03 12:20:41 -0700143
144# Allow to read graphics related properties.
145get_prop(shell, graphics_config_prop)