xref: /aosp_15_r20/system/sepolicy/private/shell.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workertypeattribute shell coredomain, mlstrustedsubject;
2*e4a36f41SAndroid Build Coastguard Worker
3*e4a36f41SAndroid Build Coastguard Worker# allow shell input injection
4*e4a36f41SAndroid Build Coastguard Workerallow shell uhid_device:chr_file rw_file_perms;
5*e4a36f41SAndroid Build Coastguard Worker
6*e4a36f41SAndroid Build Coastguard Worker# systrace support - allow atrace to run
7*e4a36f41SAndroid Build Coastguard Workerallow shell debugfs_tracing_debug:dir r_dir_perms;
8*e4a36f41SAndroid Build Coastguard Workerallow shell debugfs_tracing:dir r_dir_perms;
9*e4a36f41SAndroid Build Coastguard Workerallow shell debugfs_tracing:file rw_file_perms;
10*e4a36f41SAndroid Build Coastguard Workerallow shell debugfs_trace_marker:file getattr;
11*e4a36f41SAndroid Build Coastguard Workerallow shell atrace_exec:file rx_file_perms;
12*e4a36f41SAndroid Build Coastguard Worker
13*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
14*e4a36f41SAndroid Build Coastguard Worker  allow shell debugfs_tracing_debug:file rw_file_perms;
15*e4a36f41SAndroid Build Coastguard Worker')
16*e4a36f41SAndroid Build Coastguard Worker
17*e4a36f41SAndroid Build Coastguard Worker# read config.gz for CTS purposes
18*e4a36f41SAndroid Build Coastguard Workerallow shell config_gz:file r_file_perms;
19*e4a36f41SAndroid Build Coastguard Worker
20*e4a36f41SAndroid Build Coastguard Worker# allow reading tombstones. users can already use bugreports to get those.
21*e4a36f41SAndroid Build Coastguard Workerallow shell tombstone_data_file:dir r_dir_perms;
22*e4a36f41SAndroid Build Coastguard Workerallow shell tombstone_data_file:file r_file_perms;
23*e4a36f41SAndroid Build Coastguard Worker
24*e4a36f41SAndroid Build Coastguard Worker# Run app_process.
25*e4a36f41SAndroid Build Coastguard Worker# XXX Transition into its own domain?
26*e4a36f41SAndroid Build Coastguard Workerapp_domain(shell)
27*e4a36f41SAndroid Build Coastguard Worker
28*e4a36f41SAndroid Build Coastguard Worker# allow shell to call dumpsys storaged
29*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, storaged)
30*e4a36f41SAndroid Build Coastguard Worker
31*e4a36f41SAndroid Build Coastguard Worker# Perform SELinux access checks, needed for CTS
32*e4a36f41SAndroid Build Coastguard Workerselinux_check_access(shell)
33*e4a36f41SAndroid Build Coastguard Workerselinux_check_context(shell)
34*e4a36f41SAndroid Build Coastguard Worker
35*e4a36f41SAndroid Build Coastguard Worker# Control Perfetto traced and obtain traces from it.
36*e4a36f41SAndroid Build Coastguard Worker# Needed for Studio and debugging.
37*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(shell, traced_consumer, traced)
38*e4a36f41SAndroid Build Coastguard Worker
39*e4a36f41SAndroid Build Coastguard Worker# Allow shell binaries to write trace data to Perfetto. Used for testing and
40*e4a36f41SAndroid Build Coastguard Worker# cmdline utils.
41*e4a36f41SAndroid Build Coastguard Workerperfetto_producer(shell)
42*e4a36f41SAndroid Build Coastguard Worker
43*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(shell, vendor_shell_exec, vendor_shell)
44*e4a36f41SAndroid Build Coastguard Worker
45*e4a36f41SAndroid Build Coastguard Worker# Allow shell to execute tradeinmode for testing.
46*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(shell, tradeinmode_exec, tradeinmode)
47*e4a36f41SAndroid Build Coastguard Worker
48*e4a36f41SAndroid Build Coastguard Worker# Allow shell binaries to exec the perfetto cmdline util and have that
49*e4a36f41SAndroid Build Coastguard Worker# transition into its own domain, so that it behaves consistently to
50*e4a36f41SAndroid Build Coastguard Worker# when exec()-d by statsd.
51*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(shell, perfetto_exec, perfetto)
52*e4a36f41SAndroid Build Coastguard Worker# Allow to send SIGINT to perfetto when daemonized.
53*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto:process signal;
54*e4a36f41SAndroid Build Coastguard Worker
55*e4a36f41SAndroid Build Coastguard Worker# Allow shell to run adb shell cmd stats commands. Needed for CTS.
56*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, statsd);
57*e4a36f41SAndroid Build Coastguard Worker
58*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read and unlink traces stored in /data/misc/a11ytraces.
59*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
60*e4a36f41SAndroid Build Coastguard Worker  allow shell accessibility_trace_data_file:dir rw_dir_perms;
61*e4a36f41SAndroid Build Coastguard Worker  allow shell accessibility_trace_data_file:file { r_file_perms unlink };
62*e4a36f41SAndroid Build Coastguard Worker')
63*e4a36f41SAndroid Build Coastguard Worker
64*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read and unlink traces stored in /data/misc/perfetto-traces.
65*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_traces_data_file:dir rw_dir_perms;
66*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_traces_data_file:file { r_file_perms unlink };
67*e4a36f41SAndroid Build Coastguard Worker# ... and /data/misc/perfetto-traces/bugreport/ .
68*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_traces_bugreport_data_file:dir rw_dir_perms;
69*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_traces_bugreport_data_file:file { r_file_perms unlink };
70*e4a36f41SAndroid Build Coastguard Worker
71*e4a36f41SAndroid Build Coastguard Worker# Allow shell to create/remove configs stored in /data/misc/perfetto-configs.
72*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_configs_data_file:dir rw_dir_perms;
73*e4a36f41SAndroid Build Coastguard Workerallow shell perfetto_configs_data_file:file create_file_perms;
74*e4a36f41SAndroid Build Coastguard Worker
75*e4a36f41SAndroid Build Coastguard Worker# Allow shell to run adb shell cmd gpu commands.
76*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, gpuservice);
77*e4a36f41SAndroid Build Coastguard Worker
78*e4a36f41SAndroid Build Coastguard Worker# Allow shell to use atrace HAL
79*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(shell, hal_atrace)
80*e4a36f41SAndroid Build Coastguard Worker
81*e4a36f41SAndroid Build Coastguard Worker# For hostside tests such as CTS listening ports test.
82*e4a36f41SAndroid Build Coastguard Workerallow shell proc_net_tcp_udp:file r_file_perms;
83*e4a36f41SAndroid Build Coastguard Worker
84*e4a36f41SAndroid Build Coastguard Worker# The dl.exec_linker* tests need to execute /system/bin/linker
85*e4a36f41SAndroid Build Coastguard Worker# b/124789393
86*e4a36f41SAndroid Build Coastguard Workerallow shell system_linker_exec:file rx_file_perms;
87*e4a36f41SAndroid Build Coastguard Worker
88*e4a36f41SAndroid Build Coastguard Worker# Renderscript host side tests depend on being able to execute
89*e4a36f41SAndroid Build Coastguard Worker# /system/bin/bcc (b/126388046)
90*e4a36f41SAndroid Build Coastguard Workerallow shell rs_exec:file rx_file_perms;
91*e4a36f41SAndroid Build Coastguard Worker
92*e4a36f41SAndroid Build Coastguard Worker# Allow (host-driven) ART run-tests to execute dex2oat, in order to
93*e4a36f41SAndroid Build Coastguard Worker# check ART's compiler.
94*e4a36f41SAndroid Build Coastguard Workerallow shell dex2oat_exec:file rx_file_perms;
95*e4a36f41SAndroid Build Coastguard Workerallow shell dex2oat_exec:lnk_file read;
96*e4a36f41SAndroid Build Coastguard Worker
97*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start and comminicate with lpdumpd.
98*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, lpdumpd_prop);
99*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, lpdumpd)
100*e4a36f41SAndroid Build Coastguard Worker
101*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set and read value of properties used for CTS tests of
102*e4a36f41SAndroid Build Coastguard Worker# userspace reboot
103*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, userspace_reboot_test_prop)
104*e4a36f41SAndroid Build Coastguard Worker
105*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set this property to disable charging.
106*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, power_debug_prop)
107*e4a36f41SAndroid Build Coastguard Worker
108*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set this property used for rollback tests
109*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, rollback_test_prop)
110*e4a36f41SAndroid Build Coastguard Worker
111*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set RKP properties for testing purposes
112*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, remote_prov_prop)
113*e4a36f41SAndroid Build Coastguard Worker
114*e4a36f41SAndroid Build Coastguard Worker# Allow shell to enable 16 KB backcompat globally.
115*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, bionic_linker_16kb_app_compat_prop)
116*e4a36f41SAndroid Build Coastguard Worker
117*e4a36f41SAndroid Build Coastguard Worker# Allow shell to disable compat in package manager
118*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, pm_16kb_app_compat_prop)
119*e4a36f41SAndroid Build Coastguard Worker
120*e4a36f41SAndroid Build Coastguard Worker# Allow shell to get encryption policy of /data/local/tmp/, for CTS
121*e4a36f41SAndroid Build Coastguard Workerallowxperm shell shell_data_file:dir ioctl {
122*e4a36f41SAndroid Build Coastguard Worker  FS_IOC_GET_ENCRYPTION_POLICY
123*e4a36f41SAndroid Build Coastguard Worker  FS_IOC_GET_ENCRYPTION_POLICY_EX
124*e4a36f41SAndroid Build Coastguard Worker};
125*e4a36f41SAndroid Build Coastguard Worker
126*e4a36f41SAndroid Build Coastguard Worker# Allow shell to execute simpleperf without a domain transition.
127*e4a36f41SAndroid Build Coastguard Workerallow shell simpleperf_exec:file rx_file_perms;
128*e4a36f41SAndroid Build Coastguard Worker
129*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
130*e4a36f41SAndroid Build Coastguard Worker  # Allow shell to execute profcollectctl without a domain transition.
131*e4a36f41SAndroid Build Coastguard Worker  allow shell profcollectd_exec:file rx_file_perms;
132*e4a36f41SAndroid Build Coastguard Worker
133*e4a36f41SAndroid Build Coastguard Worker  # Allow shell to read profcollectd data files.
134*e4a36f41SAndroid Build Coastguard Worker  r_dir_file(shell, profcollectd_data_file)
135*e4a36f41SAndroid Build Coastguard Worker
136*e4a36f41SAndroid Build Coastguard Worker  # Allow to issue control commands to profcollectd binder service.
137*e4a36f41SAndroid Build Coastguard Worker  allow shell profcollectd:binder call;
138*e4a36f41SAndroid Build Coastguard Worker')
139*e4a36f41SAndroid Build Coastguard Worker
140*e4a36f41SAndroid Build Coastguard Worker# Allow shell to run remount command.
141*e4a36f41SAndroid Build Coastguard Workerallow shell remount_exec:file rx_file_perms;
142*e4a36f41SAndroid Build Coastguard Worker
143*e4a36f41SAndroid Build Coastguard Worker# Allow shell to call perf_event_open for profiling other shell processes, but
144*e4a36f41SAndroid Build Coastguard Worker# not the whole system.
145*e4a36f41SAndroid Build Coastguard Workerallow shell self:perf_event { open read write kernel };
146*e4a36f41SAndroid Build Coastguard Worker
147*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read microdroid vendor image
148*e4a36f41SAndroid Build Coastguard Workerr_dir_file(shell, vendor_microdroid_file)
149*e4a36f41SAndroid Build Coastguard Worker
150*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read /apex/apex-info-list.xml and the vendor apexes
151*e4a36f41SAndroid Build Coastguard Workerallow shell apex_info_file:file r_file_perms;
152*e4a36f41SAndroid Build Coastguard Workerallow shell vendor_apex_file:file r_file_perms;
153*e4a36f41SAndroid Build Coastguard Workerallow shell vendor_apex_file:dir r_dir_perms;
154*e4a36f41SAndroid Build Coastguard Workerallow shell vendor_apex_metadata_file:dir r_dir_perms;
155*e4a36f41SAndroid Build Coastguard Worker
156*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read updated APEXes under /data/apex
157*e4a36f41SAndroid Build Coastguard Workerallow shell apex_data_file:dir search;
158*e4a36f41SAndroid Build Coastguard Workerallow shell staging_data_file:file r_file_perms;
159*e4a36f41SAndroid Build Coastguard Worker
160*e4a36f41SAndroid Build Coastguard Worker# Set properties.
161*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, shell_prop)
162*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, ctl_bugreport_prop)
163*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, ctl_dumpstate_prop)
164*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, dumpstate_prop)
165*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, exported_dumpstate_prop)
166*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, debug_prop)
167*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, perf_drop_caches_prop)
168*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, powerctl_prop)
169*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, log_tag_prop)
170*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, wifi_log_prop)
171*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start/stop traced via the persist.traced.enable
172*e4a36f41SAndroid Build Coastguard Worker# property (which also takes care of /data/misc initialization).
173*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, traced_enabled_prop)
174*e4a36f41SAndroid Build Coastguard Worker# adjust SELinux audit rates
175*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, logd_auditrate_prop)
176*e4a36f41SAndroid Build Coastguard Worker# adjust is_loggable properties
177*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, log_prop)')
178*e4a36f41SAndroid Build Coastguard Worker# logpersist script
179*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, logpersistd_logging_prop)')
180*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start/stop heapprofd via the persist.heapprofd.enable
181*e4a36f41SAndroid Build Coastguard Worker# property.
182*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, heapprofd_enabled_prop)
183*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start/stop traced_perf via the persist.traced_perf.enable
184*e4a36f41SAndroid Build Coastguard Worker# property.
185*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, traced_perf_enabled_prop)
186*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start/stop gsid via ctl.start|stop|restart gsid.
187*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, ctl_gsid_prop)
188*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, ctl_snapuserd_prop)
189*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start/stop prefetch
190*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, ctl_prefetch_prop)
191*e4a36f41SAndroid Build Coastguard Worker# Allow shell to enable Dynamic System Update
192*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, dynamic_system_prop)
193*e4a36f41SAndroid Build Coastguard Worker# Allow shell to mock an OTA using persist.pm.mock-upgrade
194*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, mock_ota_prop)
195*e4a36f41SAndroid Build Coastguard Worker
196*e4a36f41SAndroid Build Coastguard Worker# Read device's serial number from system properties
197*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, serialno_prop)
198*e4a36f41SAndroid Build Coastguard Worker
199*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read the vendor security patch level for CTS
200*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, vendor_security_patch_level_prop)
201*e4a36f41SAndroid Build Coastguard Worker
202*e4a36f41SAndroid Build Coastguard Worker# Read state of logging-related properties
203*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, device_logging_prop)
204*e4a36f41SAndroid Build Coastguard Worker
205*e4a36f41SAndroid Build Coastguard Worker# Read state of boot reason properties
206*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, bootloader_boot_reason_prop)
207*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, last_boot_reason_prop)
208*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, system_boot_reason_prop)
209*e4a36f41SAndroid Build Coastguard Worker
210*e4a36f41SAndroid Build Coastguard Worker# Allow shell to execute the remote key provisioning factory tool
211*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, hal_keymint)
212*e4a36f41SAndroid Build Coastguard Worker# Allow shell to run the AVF RKP HAL during the execution of the remote key
213*e4a36f41SAndroid Build Coastguard Worker# provisioning factory tool.
214*e4a36f41SAndroid Build Coastguard Worker# TODO(b/351113293): Remove this once the AVF RKP HAL registration is moved to
215*e4a36f41SAndroid Build Coastguard Worker# a separate process.
216*e4a36f41SAndroid Build Coastguard Workerbinder_call(shell, virtualizationservice)
217*e4a36f41SAndroid Build Coastguard Worker# Allow the shell to inspect whether AVF remote attestation is supported
218*e4a36f41SAndroid Build Coastguard Worker# through the system property.
219*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, avf_virtualizationservice_prop)
220*e4a36f41SAndroid Build Coastguard Worker
221*e4a36f41SAndroid Build Coastguard Worker# Allow reading the outcome of perf_event_open LSM support test for CTS.
222*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, init_perf_lsm_hooks_prop)
223*e4a36f41SAndroid Build Coastguard Worker
224*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read boot image timestamps and fingerprints.
225*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, build_bootimage_prop)
226*e4a36f41SAndroid Build Coastguard Worker
227*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read odsign verification properties
228*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, odsign_prop)
229*e4a36f41SAndroid Build Coastguard Worker
230*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, persist_debug_prop)')
231*e4a36f41SAndroid Build Coastguard Worker
232*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read the keystore key contexts files. Used by native tests to test label lookup.
233*e4a36f41SAndroid Build Coastguard Workerallow shell keystore2_key_contexts_file:file r_file_perms;
234*e4a36f41SAndroid Build Coastguard Worker
235*e4a36f41SAndroid Build Coastguard Worker# Allow shell to access the keystore2_key namespace shell_key. Mainly used for native tests.
236*e4a36f41SAndroid Build Coastguard Workerallow shell shell_key:keystore2_key { delete rebind use get_info update };
237*e4a36f41SAndroid Build Coastguard Worker
238*e4a36f41SAndroid Build Coastguard Worker# Allow shell to open and execute memfd files for minijail unit tests.
239*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
240*e4a36f41SAndroid Build Coastguard Worker  allow shell appdomain_tmpfs:file { open execute_no_trans };
241*e4a36f41SAndroid Build Coastguard Worker')
242*e4a36f41SAndroid Build Coastguard Worker
243*e4a36f41SAndroid Build Coastguard Worker# Allow shell to write db.log.detailed, db.log.slow_query_threshold*
244*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, sqlite_log_prop)
245*e4a36f41SAndroid Build Coastguard Worker
246*e4a36f41SAndroid Build Coastguard Worker# Allow shell to write MTE properties even on user builds.
247*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, arm64_memtag_prop)
248*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, permissive_mte_prop)
249*e4a36f41SAndroid Build Coastguard Worker
250*e4a36f41SAndroid Build Coastguard Worker# Allow shell to write kcmdline properties even on user builds.
251*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, kcmdline_prop)
252*e4a36f41SAndroid Build Coastguard Worker
253*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read the dm-verity props on user builds.
254*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, verity_status_prop)
255*e4a36f41SAndroid Build Coastguard Worker
256*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read Virtual A/B related properties
257*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, virtual_ab_prop)
258*e4a36f41SAndroid Build Coastguard Worker
259*e4a36f41SAndroid Build Coastguard Worker# Allow ReadDefaultFstab() for CTS.
260*e4a36f41SAndroid Build Coastguard Workerread_fstab(shell)
261*e4a36f41SAndroid Build Coastguard Worker
262*e4a36f41SAndroid Build Coastguard Worker# Allow shell read access to /apex/apex-info-list.xml for CTS.
263*e4a36f41SAndroid Build Coastguard Workerallow shell apex_info_file:file r_file_perms;
264*e4a36f41SAndroid Build Coastguard Worker
265*e4a36f41SAndroid Build Coastguard Worker# Let the shell user call virtualizationservice (and
266*e4a36f41SAndroid Build Coastguard Worker# virtualizationservice call back to shell) for debugging.
267*e4a36f41SAndroid Build Coastguard Workervirtualizationservice_use(shell)
268*e4a36f41SAndroid Build Coastguard Worker
269*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set persist.wm.debug properties
270*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, persist_wm_debug_prop)')
271*e4a36f41SAndroid Build Coastguard Worker
272*e4a36f41SAndroid Build Coastguard Worker# Allow shell to write GWP-ASan properties even on user builds.
273*e4a36f41SAndroid Build Coastguard Workerset_prop(shell, gwp_asan_prop)
274*e4a36f41SAndroid Build Coastguard Worker
275*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set persist.sysui.notification.builder_extras_override property
276*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, persist_sysui_builder_extras_prop)')
277*e4a36f41SAndroid Build Coastguard Worker# Allow shell to set persist.sysui.notification.ranking_update_ashmem property
278*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`set_prop(shell, persist_sysui_ranking_update_prop)')
279*e4a36f41SAndroid Build Coastguard Worker
280*e4a36f41SAndroid Build Coastguard Worker# Allow shell to read the build properties for attestation feature
281*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, build_attestation_prop)
282*e4a36f41SAndroid Build Coastguard Worker
283*e4a36f41SAndroid Build Coastguard Worker# Allow shell to execute oatdump.
284*e4a36f41SAndroid Build Coastguard Worker# TODO (b/350628688): Remove this once it's safe to do so.
285*e4a36f41SAndroid Build Coastguard Workerallow shell oatdump_exec:file rx_file_perms;
286*e4a36f41SAndroid Build Coastguard Worker
287*e4a36f41SAndroid Build Coastguard Worker# Create and use network sockets.
288*e4a36f41SAndroid Build Coastguard Workernet_domain(shell)
289*e4a36f41SAndroid Build Coastguard Worker
290*e4a36f41SAndroid Build Coastguard Worker# logcat
291*e4a36f41SAndroid Build Coastguard Workerread_logd(shell)
292*e4a36f41SAndroid Build Coastguard Workercontrol_logd(shell)
293*e4a36f41SAndroid Build Coastguard Workerget_prop(shell, logd_prop)
294*e4a36f41SAndroid Build Coastguard Worker# logcat -L (directly, or via dumpstate)
295*e4a36f41SAndroid Build Coastguard Workerallow shell pstorefs:dir search;
296*e4a36f41SAndroid Build Coastguard Workerallow shell pstorefs:file r_file_perms;
297*e4a36f41SAndroid Build Coastguard Worker
298*e4a36f41SAndroid Build Coastguard Worker# Root fs.
299*e4a36f41SAndroid Build Coastguard Workerallow shell rootfs:dir r_dir_perms;
300*e4a36f41SAndroid Build Coastguard Worker
301*e4a36f41SAndroid Build Coastguard Worker# read files in /data/anr
302*e4a36f41SAndroid Build Coastguard Workerallow shell anr_data_file:dir r_dir_perms;
303*e4a36f41SAndroid Build Coastguard Workerallow shell anr_data_file:file r_file_perms;
304*e4a36f41SAndroid Build Coastguard Worker
305*e4a36f41SAndroid Build Coastguard Worker# Access /data/local/tmp.
306*e4a36f41SAndroid Build Coastguard Workerallow shell shell_data_file:dir create_dir_perms;
307*e4a36f41SAndroid Build Coastguard Workerallow shell shell_data_file:file create_file_perms;
308*e4a36f41SAndroid Build Coastguard Workerallow shell shell_data_file:file rx_file_perms;
309*e4a36f41SAndroid Build Coastguard Workerallow shell shell_data_file:lnk_file create_file_perms;
310*e4a36f41SAndroid Build Coastguard Worker
311*e4a36f41SAndroid Build Coastguard Worker# Access /data/local/tests.
312*e4a36f41SAndroid Build Coastguard Workerallow shell shell_test_data_file:dir create_dir_perms;
313*e4a36f41SAndroid Build Coastguard Workerallow shell shell_test_data_file:file create_file_perms;
314*e4a36f41SAndroid Build Coastguard Workerallow shell shell_test_data_file:file rx_file_perms;
315*e4a36f41SAndroid Build Coastguard Workerallow shell shell_test_data_file:lnk_file create_file_perms;
316*e4a36f41SAndroid Build Coastguard Workerallow shell shell_test_data_file:sock_file create_file_perms;
317*e4a36f41SAndroid Build Coastguard Worker
318*e4a36f41SAndroid Build Coastguard Worker# Read and delete from /data/local/traces.
319*e4a36f41SAndroid Build Coastguard Workerallow shell trace_data_file:file { r_file_perms unlink };
320*e4a36f41SAndroid Build Coastguard Workerallow shell trace_data_file:dir { r_dir_perms remove_name write };
321*e4a36f41SAndroid Build Coastguard Worker
322*e4a36f41SAndroid Build Coastguard Worker# Access /data/misc/profman.
323*e4a36f41SAndroid Build Coastguard Workerallow shell profman_dump_data_file:dir { write remove_name r_dir_perms };
324*e4a36f41SAndroid Build Coastguard Workerallow shell profman_dump_data_file:file { unlink r_file_perms };
325*e4a36f41SAndroid Build Coastguard Worker
326*e4a36f41SAndroid Build Coastguard Worker# Read/execute files in /data/nativetest
327*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
328*e4a36f41SAndroid Build Coastguard Worker  allow shell nativetest_data_file:dir r_dir_perms;
329*e4a36f41SAndroid Build Coastguard Worker  allow shell nativetest_data_file:file rx_file_perms;
330*e4a36f41SAndroid Build Coastguard Worker')
331*e4a36f41SAndroid Build Coastguard Worker
332*e4a36f41SAndroid Build Coastguard Worker# adb bugreport
333*e4a36f41SAndroid Build Coastguard Workerunix_socket_connect(shell, dumpstate, dumpstate)
334*e4a36f41SAndroid Build Coastguard Worker
335*e4a36f41SAndroid Build Coastguard Workerallow shell devpts:chr_file rw_file_perms;
336*e4a36f41SAndroid Build Coastguard Workerallow shell tty_device:chr_file rw_file_perms;
337*e4a36f41SAndroid Build Coastguard Workerallow shell console_device:chr_file rw_file_perms;
338*e4a36f41SAndroid Build Coastguard Worker
339*e4a36f41SAndroid Build Coastguard Workerallow shell input_device:dir r_dir_perms;
340*e4a36f41SAndroid Build Coastguard Workerallow shell input_device:chr_file r_file_perms;
341*e4a36f41SAndroid Build Coastguard Worker
342*e4a36f41SAndroid Build Coastguard Workerr_dir_file(shell, system_file)
343*e4a36f41SAndroid Build Coastguard Workerallow shell system_file:file x_file_perms;
344*e4a36f41SAndroid Build Coastguard Workerallow shell toolbox_exec:file rx_file_perms;
345*e4a36f41SAndroid Build Coastguard Workerallow shell shell_exec:file rx_file_perms;
346*e4a36f41SAndroid Build Coastguard Workerallow shell zygote_exec:file rx_file_perms;
347*e4a36f41SAndroid Build Coastguard Worker
348*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
349*e4a36f41SAndroid Build Coastguard Worker  # "systrace --boot" support - allow boottrace service to run
350*e4a36f41SAndroid Build Coastguard Worker  allow shell boottrace_data_file:dir rw_dir_perms;
351*e4a36f41SAndroid Build Coastguard Worker  allow shell boottrace_data_file:file create_file_perms;
352*e4a36f41SAndroid Build Coastguard Worker')
353*e4a36f41SAndroid Build Coastguard Worker
354*e4a36f41SAndroid Build Coastguard Worker# allow shell access to services
355*e4a36f41SAndroid Build Coastguard Workerallow shell servicemanager:service_manager list;
356*e4a36f41SAndroid Build Coastguard Worker# don't allow shell to access GateKeeper service
357*e4a36f41SAndroid Build Coastguard Worker# TODO: why is this so broad? Tightening candidate? It needs at list:
358*e4a36f41SAndroid Build Coastguard Worker# - dumpstate_service (so it can receive dumpstate progress updates)
359*e4a36f41SAndroid Build Coastguard Workerallow shell {
360*e4a36f41SAndroid Build Coastguard Worker  service_manager_type
361*e4a36f41SAndroid Build Coastguard Worker  -apex_service
362*e4a36f41SAndroid Build Coastguard Worker  -dnsresolver_service
363*e4a36f41SAndroid Build Coastguard Worker  -gatekeeper_service
364*e4a36f41SAndroid Build Coastguard Worker  -hal_keymint_service
365*e4a36f41SAndroid Build Coastguard Worker  -hal_secureclock_service
366*e4a36f41SAndroid Build Coastguard Worker  -hal_sharedsecret_service
367*e4a36f41SAndroid Build Coastguard Worker  -incident_service
368*e4a36f41SAndroid Build Coastguard Worker  -installd_service
369*e4a36f41SAndroid Build Coastguard Worker  -mdns_service
370*e4a36f41SAndroid Build Coastguard Worker  -netd_service
371*e4a36f41SAndroid Build Coastguard Worker  -system_suspend_control_internal_service
372*e4a36f41SAndroid Build Coastguard Worker  -system_suspend_control_service
373*e4a36f41SAndroid Build Coastguard Worker  -virtual_touchpad_service
374*e4a36f41SAndroid Build Coastguard Worker  -vold_service
375*e4a36f41SAndroid Build Coastguard Worker  -default_android_service
376*e4a36f41SAndroid Build Coastguard Worker  -virtualization_service
377*e4a36f41SAndroid Build Coastguard Worker}:service_manager find;
378*e4a36f41SAndroid Build Coastguard Workerallow shell dumpstate:binder call;
379*e4a36f41SAndroid Build Coastguard Worker
380*e4a36f41SAndroid Build Coastguard Worker# allow shell to get information from hwservicemanager
381*e4a36f41SAndroid Build Coastguard Worker# for instance, listing hardware services with lshal
382*e4a36f41SAndroid Build Coastguard Workerhwbinder_use(shell)
383*e4a36f41SAndroid Build Coastguard Workerallow shell hwservicemanager:hwservice_manager list;
384*e4a36f41SAndroid Build Coastguard Worker
385*e4a36f41SAndroid Build Coastguard Worker# allow shell to look through /proc/ for lsmod, ps, top, netstat, vmstat.
386*e4a36f41SAndroid Build Coastguard Workerr_dir_file(shell, proc_net_type)
387*e4a36f41SAndroid Build Coastguard Worker
388*e4a36f41SAndroid Build Coastguard Workerallow shell {
389*e4a36f41SAndroid Build Coastguard Worker  proc_asound
390*e4a36f41SAndroid Build Coastguard Worker  proc_cgroups
391*e4a36f41SAndroid Build Coastguard Worker  proc_filesystems
392*e4a36f41SAndroid Build Coastguard Worker  proc_interrupts
393*e4a36f41SAndroid Build Coastguard Worker  proc_loadavg # b/124024827
394*e4a36f41SAndroid Build Coastguard Worker  proc_meminfo
395*e4a36f41SAndroid Build Coastguard Worker  proc_modules
396*e4a36f41SAndroid Build Coastguard Worker  proc_pid_max
397*e4a36f41SAndroid Build Coastguard Worker  proc_slabinfo
398*e4a36f41SAndroid Build Coastguard Worker  proc_stat
399*e4a36f41SAndroid Build Coastguard Worker  proc_timer
400*e4a36f41SAndroid Build Coastguard Worker  proc_uptime
401*e4a36f41SAndroid Build Coastguard Worker  proc_version
402*e4a36f41SAndroid Build Coastguard Worker  proc_vmstat
403*e4a36f41SAndroid Build Coastguard Worker  proc_zoneinfo
404*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms;
405*e4a36f41SAndroid Build Coastguard Worker
406*e4a36f41SAndroid Build Coastguard Worker# allow listing network interfaces under /sys/class/net.
407*e4a36f41SAndroid Build Coastguard Workerallow shell sysfs_net:dir r_dir_perms;
408*e4a36f41SAndroid Build Coastguard Worker
409*e4a36f41SAndroid Build Coastguard Workerr_dir_file(shell, cgroup)
410*e4a36f41SAndroid Build Coastguard Workerallow shell cgroup_desc_file:file r_file_perms;
411*e4a36f41SAndroid Build Coastguard Workerallow shell vendor_cgroup_desc_file:file r_file_perms;
412*e4a36f41SAndroid Build Coastguard Workerr_dir_file(shell, cgroup_v2)
413*e4a36f41SAndroid Build Coastguard Workerallow shell domain:dir { search open read getattr };
414*e4a36f41SAndroid Build Coastguard Workerallow shell domain:{ file lnk_file } { open read getattr };
415*e4a36f41SAndroid Build Coastguard Worker
416*e4a36f41SAndroid Build Coastguard Worker# statvfs() of /proc and other labeled filesystems
417*e4a36f41SAndroid Build Coastguard Worker# (yaffs2, jffs2, ext2, ext3, ext4, xfs, btrfs, f2fs, squashfs, overlay)
418*e4a36f41SAndroid Build Coastguard Workerallow shell { proc labeledfs }:filesystem getattr;
419*e4a36f41SAndroid Build Coastguard Worker
420*e4a36f41SAndroid Build Coastguard Worker# stat() of /dev
421*e4a36f41SAndroid Build Coastguard Workerallow shell device:dir getattr;
422*e4a36f41SAndroid Build Coastguard Worker
423*e4a36f41SAndroid Build Coastguard Worker# allow shell to read /proc/pid/attr/current for ps -Z
424*e4a36f41SAndroid Build Coastguard Workerallow shell domain:process getattr;
425*e4a36f41SAndroid Build Coastguard Worker
426*e4a36f41SAndroid Build Coastguard Worker# Allow pulling the SELinux policy for CTS purposes
427*e4a36f41SAndroid Build Coastguard Workerallow shell selinuxfs:dir r_dir_perms;
428*e4a36f41SAndroid Build Coastguard Workerallow shell selinuxfs:file r_file_perms;
429*e4a36f41SAndroid Build Coastguard Worker
430*e4a36f41SAndroid Build Coastguard Worker# enable shell domain to read/write files/dirs for bootchart data
431*e4a36f41SAndroid Build Coastguard Worker# User will creates the start and stop file via adb shell
432*e4a36f41SAndroid Build Coastguard Worker# and read other files created by init process under /data/bootchart
433*e4a36f41SAndroid Build Coastguard Workerallow shell bootchart_data_file:dir rw_dir_perms;
434*e4a36f41SAndroid Build Coastguard Workerallow shell bootchart_data_file:file create_file_perms;
435*e4a36f41SAndroid Build Coastguard Worker
436*e4a36f41SAndroid Build Coastguard Worker# Make sure strace works for the non-privileged shell user
437*e4a36f41SAndroid Build Coastguard Workerallow shell self:process ptrace;
438*e4a36f41SAndroid Build Coastguard Worker
439*e4a36f41SAndroid Build Coastguard Worker# allow shell to get battery info
440*e4a36f41SAndroid Build Coastguard Workerallow shell sysfs:dir r_dir_perms;
441*e4a36f41SAndroid Build Coastguard Workerallow shell sysfs_batteryinfo:dir r_dir_perms;
442*e4a36f41SAndroid Build Coastguard Workerallow shell sysfs_batteryinfo:file r_file_perms;
443*e4a36f41SAndroid Build Coastguard Worker
444*e4a36f41SAndroid Build Coastguard Worker# Allow reads (but not writes) of the MGLRU state
445*e4a36f41SAndroid Build Coastguard Workerallow shell sysfs_lru_gen_enabled:file r_file_perms;
446*e4a36f41SAndroid Build Coastguard Worker
447*e4a36f41SAndroid Build Coastguard Worker# Allow communicating with the VM terminal.
448*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
449*e4a36f41SAndroid Build Coastguard Worker  allow shell vmlauncher_app_devpts:chr_file rw_file_perms;
450*e4a36f41SAndroid Build Coastguard Worker  allowxperm shell vmlauncher_app_devpts:chr_file ioctl unpriv_tty_ioctls;
451*e4a36f41SAndroid Build Coastguard Worker')
452*e4a36f41SAndroid Build Coastguard Worker
453*e4a36f41SAndroid Build Coastguard Worker# Allow CTS to check whether AVF debug policy is installed
454*e4a36f41SAndroid Build Coastguard Workerallow shell { proc_dt_avf sysfs_dt_avf }:dir search;
455*e4a36f41SAndroid Build Coastguard Worker
456*e4a36f41SAndroid Build Coastguard Worker# Allow access to ion memory allocation device.
457*e4a36f41SAndroid Build Coastguard Workerallow shell ion_device:chr_file rw_file_perms;
458*e4a36f41SAndroid Build Coastguard Worker
459*e4a36f41SAndroid Build Coastguard Worker#
460*e4a36f41SAndroid Build Coastguard Worker# filesystem test for insecure chr_file's is done
461*e4a36f41SAndroid Build Coastguard Worker# via a host side test
462*e4a36f41SAndroid Build Coastguard Worker#
463*e4a36f41SAndroid Build Coastguard Workerallow shell dev_type:dir r_dir_perms;
464*e4a36f41SAndroid Build Coastguard Workerallow shell dev_type:chr_file getattr;
465*e4a36f41SAndroid Build Coastguard Worker
466*e4a36f41SAndroid Build Coastguard Worker# /dev/fd is a symlink
467*e4a36f41SAndroid Build Coastguard Workerallow shell proc:lnk_file getattr;
468*e4a36f41SAndroid Build Coastguard Worker
469*e4a36f41SAndroid Build Coastguard Worker#
470*e4a36f41SAndroid Build Coastguard Worker# filesystem test for insucre blk_file's is done
471*e4a36f41SAndroid Build Coastguard Worker# via hostside test
472*e4a36f41SAndroid Build Coastguard Worker#
473*e4a36f41SAndroid Build Coastguard Workerallow shell dev_type:blk_file getattr;
474*e4a36f41SAndroid Build Coastguard Worker
475*e4a36f41SAndroid Build Coastguard Worker# read selinux policy files
476*e4a36f41SAndroid Build Coastguard Workerallow shell file_contexts_file:file r_file_perms;
477*e4a36f41SAndroid Build Coastguard Workerallow shell property_contexts_file:file r_file_perms;
478*e4a36f41SAndroid Build Coastguard Workerallow shell seapp_contexts_file:file r_file_perms;
479*e4a36f41SAndroid Build Coastguard Workerallow shell service_contexts_file:file r_file_perms;
480*e4a36f41SAndroid Build Coastguard Workerallow shell sepolicy_file:file r_file_perms;
481*e4a36f41SAndroid Build Coastguard Worker
482*e4a36f41SAndroid Build Coastguard Worker# Allow shell to start up vendor shell
483*e4a36f41SAndroid Build Coastguard Workerallow shell vendor_shell_exec:file rx_file_perms;
484*e4a36f41SAndroid Build Coastguard Worker
485*e4a36f41SAndroid Build Coastguard Workeris_flag_enabled(RELEASE_AVF_SUPPORT_CUSTOM_VM_WITH_PARAVIRTUALIZED_DEVICES, `
486*e4a36f41SAndroid Build Coastguard Worker  allow shell linux_vm_setup_exec:file { entrypoint r_file_perms };
487*e4a36f41SAndroid Build Coastguard Worker')
488*e4a36f41SAndroid Build Coastguard Worker
489*e4a36f41SAndroid Build Coastguard Workerallow shell tee_service_contexts_file:file r_file_perms;
490*e4a36f41SAndroid Build Coastguard Workerallow shell test_pkvm_tee_service:tee_service use;
491*e4a36f41SAndroid Build Coastguard Worker
492*e4a36f41SAndroid Build Coastguard Worker# Everything is labeled as rootfs in recovery mode. Allow shell to
493*e4a36f41SAndroid Build Coastguard Worker# execute them.
494*e4a36f41SAndroid Build Coastguard Workerrecovery_only(`
495*e4a36f41SAndroid Build Coastguard Worker  allow shell rootfs:file rx_file_perms;
496*e4a36f41SAndroid Build Coastguard Worker')
497*e4a36f41SAndroid Build Coastguard Worker
498*e4a36f41SAndroid Build Coastguard Worker###
499*e4a36f41SAndroid Build Coastguard Worker### Neverallow rules
500*e4a36f41SAndroid Build Coastguard Worker###
501*e4a36f41SAndroid Build Coastguard Worker
502*e4a36f41SAndroid Build Coastguard Worker# Do not allow shell to talk directly to security HAL services other than
503*e4a36f41SAndroid Build Coastguard Worker# hal_remotelyprovisionedcomponent_service
504*e4a36f41SAndroid Build Coastguard Workerneverallow shell {
505*e4a36f41SAndroid Build Coastguard Worker  hal_keymint_service
506*e4a36f41SAndroid Build Coastguard Worker  hal_secureclock_service
507*e4a36f41SAndroid Build Coastguard Worker  hal_sharedsecret_service
508*e4a36f41SAndroid Build Coastguard Worker  virtualization_service
509*e4a36f41SAndroid Build Coastguard Worker}:service_manager find;
510*e4a36f41SAndroid Build Coastguard Worker
511*e4a36f41SAndroid Build Coastguard Worker# Do not allow shell to hard link to any files.
512*e4a36f41SAndroid Build Coastguard Worker# In particular, if shell hard links to app data
513*e4a36f41SAndroid Build Coastguard Worker# files, installd will not be able to guarantee the deletion
514*e4a36f41SAndroid Build Coastguard Worker# of the linked to file. Hard links also contribute to security
515*e4a36f41SAndroid Build Coastguard Worker# bugs, so we want to ensure the shell user never has this
516*e4a36f41SAndroid Build Coastguard Worker# capability.
517*e4a36f41SAndroid Build Coastguard Workerneverallow shell file_type:file link;
518*e4a36f41SAndroid Build Coastguard Worker
519*e4a36f41SAndroid Build Coastguard Worker# Do not allow privileged socket ioctl commands
520*e4a36f41SAndroid Build Coastguard Workerneverallowxperm shell domain:{ rawip_socket tcp_socket udp_socket } ioctl priv_sock_ioctls;
521*e4a36f41SAndroid Build Coastguard Worker
522*e4a36f41SAndroid Build Coastguard Worker# limit shell access to sensitive char drivers to
523*e4a36f41SAndroid Build Coastguard Worker# only getattr required for host side test.
524*e4a36f41SAndroid Build Coastguard Workerneverallow shell {
525*e4a36f41SAndroid Build Coastguard Worker  fuse_device
526*e4a36f41SAndroid Build Coastguard Worker  hw_random_device
527*e4a36f41SAndroid Build Coastguard Worker  port_device
528*e4a36f41SAndroid Build Coastguard Worker}:chr_file ~getattr;
529*e4a36f41SAndroid Build Coastguard Worker
530*e4a36f41SAndroid Build Coastguard Worker# Limit shell to only getattr on blk devices for host side tests.
531*e4a36f41SAndroid Build Coastguard Workerneverallow shell dev_type:blk_file ~getattr;
532*e4a36f41SAndroid Build Coastguard Worker
533*e4a36f41SAndroid Build Coastguard Worker# b/30861057: Shell access to existing input devices is an abuse
534*e4a36f41SAndroid Build Coastguard Worker# vector. The shell user can inject events that look like they
535*e4a36f41SAndroid Build Coastguard Worker# originate from the touchscreen etc.
536*e4a36f41SAndroid Build Coastguard Worker# Everyone should have already moved to UiAutomation#injectInputEvent
537*e4a36f41SAndroid Build Coastguard Worker# if they are running instrumentation tests (i.e. CTS), Monkey for
538*e4a36f41SAndroid Build Coastguard Worker# their stress tests, and the input command (adb shell input ...) for
539*e4a36f41SAndroid Build Coastguard Worker# injecting swipes and things.
540*e4a36f41SAndroid Build Coastguard Workerneverallow shell input_device:chr_file no_w_file_perms;
541*e4a36f41SAndroid Build Coastguard Worker
542*e4a36f41SAndroid Build Coastguard Workerneverallow shell self:perf_event ~{ open read write kernel };
543*e4a36f41SAndroid Build Coastguard Worker
544*e4a36f41SAndroid Build Coastguard Worker# Never allow others to set or get the perf.drop_caches property.
545*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -shell -init } perf_drop_caches_prop:property_service set;
546*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -shell -init -dumpstate } perf_drop_caches_prop:file read;
547