xref: /aosp_15_r20/system/sepolicy/prebuilts/api/29.0/private/domain.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# Transition to crash_dump when /system/bin/crash_dump* is executed.
2*e4a36f41SAndroid Build Coastguard Worker# This occurs when the process crashes.
3*e4a36f41SAndroid Build Coastguard Worker# We do not apply this to the su domain to avoid interfering with
4*e4a36f41SAndroid Build Coastguard Worker# tests (b/114136122)
5*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans({ domain userdebug_or_eng(`-su') }, crash_dump_exec, crash_dump);
6*e4a36f41SAndroid Build Coastguard Workerallow domain crash_dump:process sigchld;
7*e4a36f41SAndroid Build Coastguard Worker
8*e4a36f41SAndroid Build Coastguard Worker# Allow every process to check the heapprofd.enable properties to determine
9*e4a36f41SAndroid Build Coastguard Worker# whether to load the heap profiling library. This does not necessarily enable
10*e4a36f41SAndroid Build Coastguard Worker# heap profiling, as initialization will fail if it does not have the
11*e4a36f41SAndroid Build Coastguard Worker# necessary SELinux permissions.
12*e4a36f41SAndroid Build Coastguard Workerget_prop(domain, heapprofd_prop);
13*e4a36f41SAndroid Build Coastguard Worker# Allow heap profiling on debug builds.
14*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`can_profile_heap_userdebug_or_eng({
15*e4a36f41SAndroid Build Coastguard Worker  domain
16*e4a36f41SAndroid Build Coastguard Worker  -bpfloader
17*e4a36f41SAndroid Build Coastguard Worker  -init
18*e4a36f41SAndroid Build Coastguard Worker  -kernel
19*e4a36f41SAndroid Build Coastguard Worker  -keystore
20*e4a36f41SAndroid Build Coastguard Worker  -llkd
21*e4a36f41SAndroid Build Coastguard Worker  -logd
22*e4a36f41SAndroid Build Coastguard Worker  -logpersist
23*e4a36f41SAndroid Build Coastguard Worker  -recovery
24*e4a36f41SAndroid Build Coastguard Worker  -recovery_persist
25*e4a36f41SAndroid Build Coastguard Worker  -recovery_refresh
26*e4a36f41SAndroid Build Coastguard Worker  -ueventd
27*e4a36f41SAndroid Build Coastguard Worker  -vendor_init
28*e4a36f41SAndroid Build Coastguard Worker  -vold
29*e4a36f41SAndroid Build Coastguard Worker})')
30*e4a36f41SAndroid Build Coastguard Worker
31*e4a36f41SAndroid Build Coastguard Worker# Path resolution access in cgroups.
32*e4a36f41SAndroid Build Coastguard Workerallow domain cgroup:dir search;
33*e4a36f41SAndroid Build Coastguard Workerallow { domain -appdomain -rs } cgroup:dir w_dir_perms;
34*e4a36f41SAndroid Build Coastguard Workerallow { domain -appdomain -rs } cgroup:file w_file_perms;
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Workerallow domain cgroup_rc_file:dir search;
37*e4a36f41SAndroid Build Coastguard Workerallow domain cgroup_rc_file:file r_file_perms;
38*e4a36f41SAndroid Build Coastguard Workerallow domain task_profiles_file:file r_file_perms;
39*e4a36f41SAndroid Build Coastguard Workerallow domain vendor_task_profiles_file:file r_file_perms;
40*e4a36f41SAndroid Build Coastguard Worker
41*e4a36f41SAndroid Build Coastguard Worker# Allow all domains to read sys.use_memfd to determine
42*e4a36f41SAndroid Build Coastguard Worker# if memfd support can be used if device supports it
43*e4a36f41SAndroid Build Coastguard Workerget_prop(domain, use_memfd_prop);
44*e4a36f41SAndroid Build Coastguard Worker
45*e4a36f41SAndroid Build Coastguard Worker# For now, everyone can access core property files
46*e4a36f41SAndroid Build Coastguard Worker# Device specific properties are not granted by default
47*e4a36f41SAndroid Build Coastguard Workernot_compatible_property(`
48*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, core_property_type)
49*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported_dalvik_prop)
50*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported_ffs_prop)
51*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported_system_radio_prop)
52*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported2_config_prop)
53*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported2_radio_prop)
54*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported2_system_prop)
55*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported2_vold_prop)
56*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported3_default_prop)
57*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported3_radio_prop)
58*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, exported3_system_prop)
59*e4a36f41SAndroid Build Coastguard Worker    get_prop(domain, vendor_default_prop)
60*e4a36f41SAndroid Build Coastguard Worker')
61*e4a36f41SAndroid Build Coastguard Workercompatible_property_only(`
62*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, core_property_type)
63*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported_dalvik_prop)
64*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported_ffs_prop)
65*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported_system_radio_prop)
66*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported2_config_prop)
67*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported2_radio_prop)
68*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported2_system_prop)
69*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported2_vold_prop)
70*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported3_default_prop)
71*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported3_radio_prop)
72*e4a36f41SAndroid Build Coastguard Worker    get_prop({coredomain appdomain shell}, exported3_system_prop)
73*e4a36f41SAndroid Build Coastguard Worker    get_prop({domain -coredomain -appdomain}, vendor_default_prop)
74*e4a36f41SAndroid Build Coastguard Worker')
75*e4a36f41SAndroid Build Coastguard Worker
76*e4a36f41SAndroid Build Coastguard Worker# Allow access to fsverity keyring.
77*e4a36f41SAndroid Build Coastguard Workerallow domain kernel:key search;
78*e4a36f41SAndroid Build Coastguard Worker# Allow access to keys in the fsverity keyring that were installed at boot.
79*e4a36f41SAndroid Build Coastguard Workerallow domain fsverity_init:key search;
80*e4a36f41SAndroid Build Coastguard Worker# For testing purposes, allow access to keys installed with su.
81*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
82*e4a36f41SAndroid Build Coastguard Worker  allow domain su:key search;
83*e4a36f41SAndroid Build Coastguard Worker')
84*e4a36f41SAndroid Build Coastguard Worker
85*e4a36f41SAndroid Build Coastguard Worker# Limit ability to ptrace or read sensitive /proc/pid files of processes
86*e4a36f41SAndroid Build Coastguard Worker# with other UIDs to these allowlisted domains.
87*e4a36f41SAndroid Build Coastguard Workerneverallow {
88*e4a36f41SAndroid Build Coastguard Worker  domain
89*e4a36f41SAndroid Build Coastguard Worker  -vold
90*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-llkd')
91*e4a36f41SAndroid Build Coastguard Worker  -dumpstate
92*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-incidentd')
93*e4a36f41SAndroid Build Coastguard Worker  -storaged
94*e4a36f41SAndroid Build Coastguard Worker  -system_server
95*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-perfprofd')
96*e4a36f41SAndroid Build Coastguard Worker} self:global_capability_class_set sys_ptrace;
97*e4a36f41SAndroid Build Coastguard Worker
98*e4a36f41SAndroid Build Coastguard Worker# Limit ability to generate hardware unique device ID attestations to priv_apps
99*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -priv_app } *:keystore_key gen_unique_id;
100*e4a36f41SAndroid Build Coastguard Worker
101*e4a36f41SAndroid Build Coastguard Workerneverallow {
102*e4a36f41SAndroid Build Coastguard Worker  domain
103*e4a36f41SAndroid Build Coastguard Worker  -init
104*e4a36f41SAndroid Build Coastguard Worker  -vendor_init
105*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-domain')
106*e4a36f41SAndroid Build Coastguard Worker} debugfs_tracing_debug:file no_rw_file_perms;
107*e4a36f41SAndroid Build Coastguard Worker
108*e4a36f41SAndroid Build Coastguard Worker# System_server owns dropbox data, and init creates/restorecons the directory
109*e4a36f41SAndroid Build Coastguard Worker# Disallow direct access by other processes.
110*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_server } dropbox_data_file:dir *;
111*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_server } dropbox_data_file:file ~{ getattr read };
112*e4a36f41SAndroid Build Coastguard Worker
113*e4a36f41SAndroid Build Coastguard Worker###
114*e4a36f41SAndroid Build Coastguard Worker# Services should respect app sandboxes
115*e4a36f41SAndroid Build Coastguard Workerneverallow {
116*e4a36f41SAndroid Build Coastguard Worker  domain
117*e4a36f41SAndroid Build Coastguard Worker  -appdomain
118*e4a36f41SAndroid Build Coastguard Worker  -installd # creation of sandbox
119*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:dir_file_class_set { create unlink };
120*e4a36f41SAndroid Build Coastguard Worker
121*e4a36f41SAndroid Build Coastguard Worker# Only the following processes should be directly accessing private app
122*e4a36f41SAndroid Build Coastguard Worker# directories.
123*e4a36f41SAndroid Build Coastguard Workerneverallow {
124*e4a36f41SAndroid Build Coastguard Worker  domain
125*e4a36f41SAndroid Build Coastguard Worker  -adbd
126*e4a36f41SAndroid Build Coastguard Worker  -appdomain
127*e4a36f41SAndroid Build Coastguard Worker  -app_zygote
128*e4a36f41SAndroid Build Coastguard Worker  -dexoptanalyzer
129*e4a36f41SAndroid Build Coastguard Worker  -installd
130*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-perfprofd')
131*e4a36f41SAndroid Build Coastguard Worker  -profman
132*e4a36f41SAndroid Build Coastguard Worker  -rs # spawned by appdomain, so carryover the exception above
133*e4a36f41SAndroid Build Coastguard Worker  -runas
134*e4a36f41SAndroid Build Coastguard Worker  -system_server
135*e4a36f41SAndroid Build Coastguard Worker  -viewcompiler
136*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:dir *;
137*e4a36f41SAndroid Build Coastguard Worker
138*e4a36f41SAndroid Build Coastguard Worker# Only apps should be modifying app data. installd is exempted for
139*e4a36f41SAndroid Build Coastguard Worker# restorecon and package install/uninstall.
140*e4a36f41SAndroid Build Coastguard Workerneverallow {
141*e4a36f41SAndroid Build Coastguard Worker  domain
142*e4a36f41SAndroid Build Coastguard Worker  -appdomain
143*e4a36f41SAndroid Build Coastguard Worker  -installd
144*e4a36f41SAndroid Build Coastguard Worker  -rs # spawned by appdomain, so carryover the exception above
145*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:dir ~r_dir_perms;
146*e4a36f41SAndroid Build Coastguard Worker
147*e4a36f41SAndroid Build Coastguard Workerneverallow {
148*e4a36f41SAndroid Build Coastguard Worker  domain
149*e4a36f41SAndroid Build Coastguard Worker  -appdomain
150*e4a36f41SAndroid Build Coastguard Worker  -app_zygote
151*e4a36f41SAndroid Build Coastguard Worker  -installd
152*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-perfprofd')
153*e4a36f41SAndroid Build Coastguard Worker  -rs # spawned by appdomain, so carryover the exception above
154*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:file_class_set open;
155*e4a36f41SAndroid Build Coastguard Worker
156*e4a36f41SAndroid Build Coastguard Workerneverallow {
157*e4a36f41SAndroid Build Coastguard Worker  domain
158*e4a36f41SAndroid Build Coastguard Worker  -appdomain
159*e4a36f41SAndroid Build Coastguard Worker  -installd # creation of sandbox
160*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:dir_file_class_set { create unlink };
161*e4a36f41SAndroid Build Coastguard Worker
162*e4a36f41SAndroid Build Coastguard Workerneverallow {
163*e4a36f41SAndroid Build Coastguard Worker  domain
164*e4a36f41SAndroid Build Coastguard Worker  -installd
165*e4a36f41SAndroid Build Coastguard Worker} { privapp_data_file app_data_file }:dir_file_class_set { relabelfrom relabelto };
166*e4a36f41SAndroid Build Coastguard Worker
167*e4a36f41SAndroid Build Coastguard Worker# The staging directory contains APEX and APK files. It is important to ensure
168*e4a36f41SAndroid Build Coastguard Worker# that these files cannot be accessed by other domains to ensure that the files
169*e4a36f41SAndroid Build Coastguard Worker# do not change between system_server staging the files and apexd processing
170*e4a36f41SAndroid Build Coastguard Worker# the files.
171*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_server -apexd -installd} staging_data_file:dir *;
172*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_app -system_server -apexd -kernel -installd } staging_data_file:file *;
173*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_server -installd} staging_data_file:dir no_w_dir_perms;
174*e4a36f41SAndroid Build Coastguard Worker# apexd needs the link and unlink permissions, so list every `no_w_file_perms`
175*e4a36f41SAndroid Build Coastguard Worker# except for `link` and `unlink`.
176*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -system_server } staging_data_file:file
177*e4a36f41SAndroid Build Coastguard Worker  { append create relabelfrom rename setattr write no_x_file_perms };
178*e4a36f41SAndroid Build Coastguard Worker
179*e4a36f41SAndroid Build Coastguard Workerneverallow {
180*e4a36f41SAndroid Build Coastguard Worker    domain
181*e4a36f41SAndroid Build Coastguard Worker    -appdomain # for oemfs
182*e4a36f41SAndroid Build Coastguard Worker    -bootanim # for oemfs
183*e4a36f41SAndroid Build Coastguard Worker    -recovery # for /tmp/update_binary in tmpfs
184*e4a36f41SAndroid Build Coastguard Worker} { fs_type -rootfs }:file execute;
185*e4a36f41SAndroid Build Coastguard Worker
186*e4a36f41SAndroid Build Coastguard Worker#
187*e4a36f41SAndroid Build Coastguard Worker# Assert that, to the extent possible, we're not loading executable content from
188*e4a36f41SAndroid Build Coastguard Worker# outside the rootfs or /system partition except for a few allowlisted domains.
189*e4a36f41SAndroid Build Coastguard Worker# Executable files loaded from /data is a persistence vector
190*e4a36f41SAndroid Build Coastguard Worker# we want to avoid. See
191*e4a36f41SAndroid Build Coastguard Worker# https://bugs.chromium.org/p/project-zero/issues/detail?id=955 for example.
192*e4a36f41SAndroid Build Coastguard Worker#
193*e4a36f41SAndroid Build Coastguard Workerneverallow {
194*e4a36f41SAndroid Build Coastguard Worker    domain
195*e4a36f41SAndroid Build Coastguard Worker    -appdomain
196*e4a36f41SAndroid Build Coastguard Worker    with_asan(`-asan_extract')
197*e4a36f41SAndroid Build Coastguard Worker    -shell
198*e4a36f41SAndroid Build Coastguard Worker    userdebug_or_eng(`-su')
199*e4a36f41SAndroid Build Coastguard Worker    -system_server_startup # for memfd backed executable regions
200*e4a36f41SAndroid Build Coastguard Worker    -app_zygote
201*e4a36f41SAndroid Build Coastguard Worker    -webview_zygote
202*e4a36f41SAndroid Build Coastguard Worker    -zygote
203*e4a36f41SAndroid Build Coastguard Worker    userdebug_or_eng(`-mediaextractor')
204*e4a36f41SAndroid Build Coastguard Worker    userdebug_or_eng(`-mediaswcodec')
205*e4a36f41SAndroid Build Coastguard Worker} {
206*e4a36f41SAndroid Build Coastguard Worker    file_type
207*e4a36f41SAndroid Build Coastguard Worker    -system_file_type
208*e4a36f41SAndroid Build Coastguard Worker    -system_lib_file
209*e4a36f41SAndroid Build Coastguard Worker    -system_linker_exec
210*e4a36f41SAndroid Build Coastguard Worker    -vendor_file_type
211*e4a36f41SAndroid Build Coastguard Worker    -exec_type
212*e4a36f41SAndroid Build Coastguard Worker    -postinstall_file
213*e4a36f41SAndroid Build Coastguard Worker}:file execute;
214*e4a36f41SAndroid Build Coastguard Worker
215*e4a36f41SAndroid Build Coastguard Worker# Only init is allowed to write cgroup.rc file
216*e4a36f41SAndroid Build Coastguard Workerneverallow {
217*e4a36f41SAndroid Build Coastguard Worker  domain
218*e4a36f41SAndroid Build Coastguard Worker  -init
219*e4a36f41SAndroid Build Coastguard Worker  -vendor_init
220*e4a36f41SAndroid Build Coastguard Worker} cgroup_rc_file:file no_w_file_perms;
221*e4a36f41SAndroid Build Coastguard Worker
222*e4a36f41SAndroid Build Coastguard Worker# Only authorized processes should be writing to files in /data/dalvik-cache
223*e4a36f41SAndroid Build Coastguard Workerneverallow {
224*e4a36f41SAndroid Build Coastguard Worker  domain
225*e4a36f41SAndroid Build Coastguard Worker  -init # TODO: limit init to relabelfrom for files
226*e4a36f41SAndroid Build Coastguard Worker  -zygote
227*e4a36f41SAndroid Build Coastguard Worker  -installd
228*e4a36f41SAndroid Build Coastguard Worker  -postinstall_dexopt
229*e4a36f41SAndroid Build Coastguard Worker  -cppreopts
230*e4a36f41SAndroid Build Coastguard Worker  -dex2oat
231*e4a36f41SAndroid Build Coastguard Worker  -otapreopt_slot
232*e4a36f41SAndroid Build Coastguard Worker  -art_apex_postinstall
233*e4a36f41SAndroid Build Coastguard Worker  -art_apex_boot_integrity
234*e4a36f41SAndroid Build Coastguard Worker} dalvikcache_data_file:file no_w_file_perms;
235*e4a36f41SAndroid Build Coastguard Worker
236*e4a36f41SAndroid Build Coastguard Workerneverallow {
237*e4a36f41SAndroid Build Coastguard Worker  domain
238*e4a36f41SAndroid Build Coastguard Worker  -init
239*e4a36f41SAndroid Build Coastguard Worker  -installd
240*e4a36f41SAndroid Build Coastguard Worker  -postinstall_dexopt
241*e4a36f41SAndroid Build Coastguard Worker  -cppreopts
242*e4a36f41SAndroid Build Coastguard Worker  -dex2oat
243*e4a36f41SAndroid Build Coastguard Worker  -zygote
244*e4a36f41SAndroid Build Coastguard Worker  -otapreopt_slot
245*e4a36f41SAndroid Build Coastguard Worker  -art_apex_boot_integrity
246*e4a36f41SAndroid Build Coastguard Worker  -art_apex_postinstall
247*e4a36f41SAndroid Build Coastguard Worker} dalvikcache_data_file:dir no_w_dir_perms;
248*e4a36f41SAndroid Build Coastguard Worker
249*e4a36f41SAndroid Build Coastguard Worker# Minimize dac_override and dac_read_search.
250*e4a36f41SAndroid Build Coastguard Worker# Instead of granting them it is usually better to add the domain to
251*e4a36f41SAndroid Build Coastguard Worker# a Unix group or change the permissions of a file.
252*e4a36f41SAndroid Build Coastguard Workerdefine(`dac_override_allowed', `{
253*e4a36f41SAndroid Build Coastguard Worker  dnsmasq
254*e4a36f41SAndroid Build Coastguard Worker  dumpstate
255*e4a36f41SAndroid Build Coastguard Worker  init
256*e4a36f41SAndroid Build Coastguard Worker  installd
257*e4a36f41SAndroid Build Coastguard Worker  install_recovery
258*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`llkd')
259*e4a36f41SAndroid Build Coastguard Worker  lmkd
260*e4a36f41SAndroid Build Coastguard Worker  migrate_legacy_obb_data
261*e4a36f41SAndroid Build Coastguard Worker  netd
262*e4a36f41SAndroid Build Coastguard Worker  perfprofd
263*e4a36f41SAndroid Build Coastguard Worker  postinstall_dexopt
264*e4a36f41SAndroid Build Coastguard Worker  recovery
265*e4a36f41SAndroid Build Coastguard Worker  rss_hwm_reset
266*e4a36f41SAndroid Build Coastguard Worker  sdcardd
267*e4a36f41SAndroid Build Coastguard Worker  tee
268*e4a36f41SAndroid Build Coastguard Worker  ueventd
269*e4a36f41SAndroid Build Coastguard Worker  uncrypt
270*e4a36f41SAndroid Build Coastguard Worker  vendor_init
271*e4a36f41SAndroid Build Coastguard Worker  vold
272*e4a36f41SAndroid Build Coastguard Worker  vold_prepare_subdirs
273*e4a36f41SAndroid Build Coastguard Worker  zygote
274*e4a36f41SAndroid Build Coastguard Worker}')
275*e4a36f41SAndroid Build Coastguard Workerneverallow ~dac_override_allowed self:global_capability_class_set dac_override;
276*e4a36f41SAndroid Build Coastguard Worker# Since the kernel checks dac_read_search before dac_override, domains that
277*e4a36f41SAndroid Build Coastguard Worker# have dac_override should also have dac_read_search to eliminate spurious
278*e4a36f41SAndroid Build Coastguard Worker# denials.  Some domains have dac_read_search without having dac_override, so
279*e4a36f41SAndroid Build Coastguard Worker# this list should be a superset of the one above.
280*e4a36f41SAndroid Build Coastguard Workerneverallow ~{
281*e4a36f41SAndroid Build Coastguard Worker  dac_override_allowed
282*e4a36f41SAndroid Build Coastguard Worker  traced_probes
283*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`heapprofd')
284*e4a36f41SAndroid Build Coastguard Worker} self:global_capability_class_set dac_read_search;
285*e4a36f41SAndroid Build Coastguard Worker
286*e4a36f41SAndroid Build Coastguard Worker# Limit what domains can mount filesystems or change their mount flags.
287*e4a36f41SAndroid Build Coastguard Worker# sdcard_type / vfat is exempt as a larger set of domains need
288*e4a36f41SAndroid Build Coastguard Worker# this capability, including device-specific domains.
289*e4a36f41SAndroid Build Coastguard Workerneverallow {
290*e4a36f41SAndroid Build Coastguard Worker    domain
291*e4a36f41SAndroid Build Coastguard Worker    -apexd
292*e4a36f41SAndroid Build Coastguard Worker    recovery_only(`userdebug_or_eng(`-fastbootd')')
293*e4a36f41SAndroid Build Coastguard Worker    -init
294*e4a36f41SAndroid Build Coastguard Worker    -kernel
295*e4a36f41SAndroid Build Coastguard Worker    -otapreopt_chroot
296*e4a36f41SAndroid Build Coastguard Worker    -recovery
297*e4a36f41SAndroid Build Coastguard Worker    -update_engine
298*e4a36f41SAndroid Build Coastguard Worker    -vold
299*e4a36f41SAndroid Build Coastguard Worker    -zygote
300*e4a36f41SAndroid Build Coastguard Worker} { fs_type -sdcard_type }:filesystem { mount remount relabelfrom relabelto };
301*e4a36f41SAndroid Build Coastguard Worker
302*e4a36f41SAndroid Build Coastguard Worker# Limit raw I/O to these allowlisted domains. Do not apply to debug builds.
303*e4a36f41SAndroid Build Coastguard Workerneverallow {
304*e4a36f41SAndroid Build Coastguard Worker  domain
305*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-domain')
306*e4a36f41SAndroid Build Coastguard Worker  -kernel
307*e4a36f41SAndroid Build Coastguard Worker  -gsid
308*e4a36f41SAndroid Build Coastguard Worker  -init
309*e4a36f41SAndroid Build Coastguard Worker  -recovery
310*e4a36f41SAndroid Build Coastguard Worker  -ueventd
311*e4a36f41SAndroid Build Coastguard Worker  -healthd
312*e4a36f41SAndroid Build Coastguard Worker  -uncrypt
313*e4a36f41SAndroid Build Coastguard Worker  -tee
314*e4a36f41SAndroid Build Coastguard Worker  -hal_bootctl_server
315*e4a36f41SAndroid Build Coastguard Worker} self:global_capability_class_set sys_rawio;
316