2020-03-04 09:20:35 +01:00
|
|
|
|
2017-03-23 22:27:32 +01:00
|
|
|
typeattribute shell coredomain;
|
|
|
|
|
2017-05-11 04:37:06 +02:00
|
|
|
# allow shell input injection
|
|
|
|
allow shell uhid_device:chr_file rw_file_perms;
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
# systrace support - allow atrace to run
|
2018-01-31 03:14:45 +01:00
|
|
|
allow shell debugfs_tracing_debug:dir r_dir_perms;
|
2016-10-12 23:58:09 +02:00
|
|
|
allow shell debugfs_tracing:dir r_dir_perms;
|
2017-07-27 01:22:50 +02:00
|
|
|
allow shell debugfs_tracing:file rw_file_perms;
|
2016-10-12 23:58:09 +02:00
|
|
|
allow shell debugfs_trace_marker:file getattr;
|
|
|
|
allow shell atrace_exec:file rx_file_perms;
|
|
|
|
|
2017-04-14 21:12:50 +02:00
|
|
|
userdebug_or_eng(`
|
2017-07-27 18:50:25 +02:00
|
|
|
allow shell debugfs_tracing_debug:file rw_file_perms;
|
2017-04-14 21:12:50 +02:00
|
|
|
')
|
|
|
|
|
2018-01-31 03:14:45 +01:00
|
|
|
# read config.gz for CTS purposes
|
|
|
|
allow shell config_gz:file r_file_perms;
|
|
|
|
|
2016-12-08 20:23:34 +01:00
|
|
|
# Run app_process.
|
|
|
|
# XXX Transition into its own domain?
|
|
|
|
app_domain(shell)
|
2017-03-23 20:28:20 +01:00
|
|
|
|
|
|
|
# allow shell to call dumpsys storaged
|
|
|
|
binder_call(shell, storaged)
|
2017-05-08 18:51:59 +02:00
|
|
|
|
|
|
|
# Perform SELinux access checks, needed for CTS
|
|
|
|
selinux_check_access(shell)
|
|
|
|
selinux_check_context(shell)
|
2017-12-21 03:51:15 +01:00
|
|
|
|
|
|
|
# Control Perfetto traced and obtain traces from it.
|
|
|
|
# Needed for Studio and debugging.
|
|
|
|
unix_socket_connect(shell, traced_consumer, traced)
|
|
|
|
|
|
|
|
# Allow shell binaries to write trace data to Perfetto. Used for testing and
|
|
|
|
# cmdline utils.
|
2019-10-08 17:15:14 +02:00
|
|
|
perfetto_producer(shell)
|
2018-01-11 20:01:30 +01:00
|
|
|
|
|
|
|
domain_auto_trans(shell, vendor_shell_exec, vendor_shell)
|
2018-01-24 17:07:09 +01:00
|
|
|
|
|
|
|
# Allow shell binaries to exec the perfetto cmdline util and have that
|
|
|
|
# transition into its own domain, so that it behaves consistently to
|
|
|
|
# when exec()-d by statsd.
|
|
|
|
domain_auto_trans(shell, perfetto_exec, perfetto)
|
2018-12-06 14:28:01 +01:00
|
|
|
# Allow to send SIGINT to perfetto when daemonized.
|
|
|
|
allow shell perfetto:process signal;
|
2018-01-24 17:07:09 +01:00
|
|
|
|
2018-02-13 18:33:36 +01:00
|
|
|
# Allow shell to run adb shell cmd stats commands. Needed for CTS.
|
|
|
|
binder_call(shell, statsd);
|
|
|
|
|
2018-01-24 17:07:09 +01:00
|
|
|
# Allow shell to read and unlink traces stored in /data/misc/perfetto-traces.
|
|
|
|
allow shell perfetto_traces_data_file:dir rw_dir_perms;
|
2019-09-30 12:09:45 +02:00
|
|
|
allow shell perfetto_traces_data_file:file { r_file_perms unlink };
|
2018-09-18 02:06:19 +02:00
|
|
|
|
2018-11-28 00:21:43 +01:00
|
|
|
# Allow shell to run adb shell cmd gpu commands.
|
|
|
|
binder_call(shell, gpuservice);
|
|
|
|
|
2018-09-20 01:06:28 +02:00
|
|
|
# Allow shell to use atrace HAL
|
|
|
|
hal_client_domain(shell, hal_atrace)
|
2018-09-28 19:55:14 +02:00
|
|
|
|
|
|
|
# For hostside tests such as CTS listening ports test.
|
|
|
|
allow shell proc_net_tcp_udp:file r_file_perms;
|
2019-02-26 00:11:40 +01:00
|
|
|
|
|
|
|
# The dl.exec_linker* tests need to execute /system/bin/linker
|
|
|
|
# b/124789393
|
|
|
|
allow shell system_linker_exec:file rx_file_perms;
|
2019-02-26 21:30:42 +01:00
|
|
|
|
|
|
|
# Renderscript host side tests depend on being able to execute
|
|
|
|
# /system/bin/bcc (b/126388046)
|
|
|
|
allow shell rs_exec:file rx_file_perms;
|
2019-03-14 23:45:03 +01:00
|
|
|
|
|
|
|
# Allow shell to start and comminicate with lpdumpd.
|
|
|
|
set_prop(shell, lpdumpd_prop);
|
|
|
|
binder_call(shell, lpdumpd)
|
2019-08-09 07:20:34 +02:00
|
|
|
|
2020-03-12 15:45:00 +01:00
|
|
|
# Allow shell to set and read value of properties used for CTS tests of
|
|
|
|
# userspace reboot
|
|
|
|
set_prop(shell, userspace_reboot_test_prop)
|
|
|
|
|
2019-09-27 22:33:27 +02:00
|
|
|
# Allow shell to get encryption policy of /data/local/tmp/, for CTS
|
|
|
|
allowxperm shell shell_data_file:dir ioctl {
|
|
|
|
FS_IOC_GET_ENCRYPTION_POLICY
|
|
|
|
FS_IOC_GET_ENCRYPTION_POLICY_EX
|
|
|
|
};
|
2020-01-10 20:02:43 +01:00
|
|
|
|
|
|
|
# Allow shell to execute simpleperf without a domain transition.
|
|
|
|
allow shell simpleperf_exec:file rx_file_perms;
|
|
|
|
|
|
|
|
# Allow shell to call perf_event_open for profiling other shell processes, but
|
|
|
|
# not the whole system.
|
|
|
|
allow shell self:perf_event { open read write kernel };
|
|
|
|
neverallow shell self:perf_event ~{ open read write kernel };
|
2020-03-04 09:20:35 +01:00
|
|
|
|
|
|
|
# Set properties.
|
|
|
|
set_prop(shell, shell_prop)
|
|
|
|
set_prop(shell, ctl_bugreport_prop)
|
|
|
|
set_prop(shell, ctl_dumpstate_prop)
|
|
|
|
set_prop(shell, dumpstate_prop)
|
|
|
|
set_prop(shell, exported_dumpstate_prop)
|
|
|
|
set_prop(shell, debug_prop)
|
|
|
|
set_prop(shell, powerctl_prop)
|
|
|
|
set_prop(shell, log_tag_prop)
|
|
|
|
set_prop(shell, wifi_log_prop)
|
|
|
|
# Allow shell to start/stop traced via the persist.traced.enable
|
|
|
|
# property (which also takes care of /data/misc initialization).
|
|
|
|
set_prop(shell, traced_enabled_prop)
|
|
|
|
# adjust is_loggable properties
|
|
|
|
userdebug_or_eng(`set_prop(shell, log_prop)')
|
|
|
|
# logpersist script
|
|
|
|
userdebug_or_eng(`set_prop(shell, logpersistd_logging_prop)')
|
|
|
|
# Allow shell to start/stop heapprofd via the persist.heapprofd.enable
|
|
|
|
# property.
|
|
|
|
set_prop(shell, heapprofd_enabled_prop)
|
|
|
|
# Allow shell to start/stop traced_perf via the persist.traced_perf.enable
|
|
|
|
# property.
|
|
|
|
set_prop(shell, traced_perf_enabled_prop)
|
|
|
|
# Allow shell to start/stop gsid via ctl.start|stop|restart gsid.
|
|
|
|
set_prop(shell, ctl_gsid_prop)
|
|
|
|
# Allow shell to enable Dynamic System Update
|
|
|
|
set_prop(shell, dynamic_system_prop)
|
|
|
|
# Allow shell to mock an OTA using persist.pm.mock-upgrade
|
|
|
|
set_prop(shell, mock_ota_prop)
|
|
|
|
|
|
|
|
# Read device's serial number from system properties
|
|
|
|
get_prop(shell, serialno_prop)
|
|
|
|
|
|
|
|
# Allow shell to read the vendor security patch level for CTS
|
|
|
|
get_prop(shell, vendor_security_patch_level_prop)
|
|
|
|
|
|
|
|
# Read state of logging-related properties
|
|
|
|
get_prop(shell, device_logging_prop)
|
|
|
|
|
|
|
|
# Read state of boot reason properties
|
|
|
|
get_prop(shell, bootloader_boot_reason_prop)
|
|
|
|
get_prop(shell, last_boot_reason_prop)
|
|
|
|
get_prop(shell, system_boot_reason_prop)
|
|
|
|
|
|
|
|
# Allow reading the outcome of perf_event_open LSM support test for CTS.
|
|
|
|
get_prop(shell, init_perf_lsm_hooks_prop)
|
|
|
|
|
|
|
|
userdebug_or_eng(`set_prop(shell, persist_debug_prop)')
|
2020-06-03 21:20:41 +02:00
|
|
|
|
|
|
|
# Allow to read graphics related properties.
|
|
|
|
get_prop(shell, graphics_config_prop)
|
2020-06-18 06:43:23 +02:00
|
|
|
|
|
|
|
# Allow to issue control commands to profcollectd binder service.
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow shell profcollectd:binder call;
|
|
|
|
')
|