blob: b73666560e11555d68157f302a0ae79539fb26f8 [file] [log] [blame]
Jiakai Zhangc871c1c2022-07-19 21:29:31 +01001# ART service daemon.
2typeattribute artd coredomain;
Chris Wailes467d8a82021-03-03 12:30:28 -08003type artd_exec, system_file_type, exec_type, file_type;
Jiakai Zhang76bfb7e2022-05-26 13:55:33 +01004type artd_tmpfs, file_type;
Chris Wailes467d8a82021-03-03 12:30:28 -08005
6# Allow artd to publish a binder service and make binder calls.
7binder_use(artd)
8add_service(artd, artd_service)
9allow artd dumpstate:fifo_file { getattr write };
10
Chris Wailes467d8a82021-03-03 12:30:28 -080011init_daemon_domain(artd)
Calin Juravle0b2ca6c2021-05-18 15:33:08 -070012
13# Allow query ART device config properties
14get_prop(artd, device_config_runtime_native_prop)
15get_prop(artd, device_config_runtime_native_boot_prop)
Jiakai Zhang76bfb7e2022-05-26 13:55:33 +010016
17# Access to "odsign.verification.success" for deciding whether to deny files in
18# the ART APEX data directory.
19get_prop(artd, odsign_prop)
20
21# Reading an APK opens a ZipArchive, which unpack to tmpfs.
22# Use tmpfs_domain() which will give tmpfs files created by artd their
23# own label, which differs from other labels created by other processes.
24# This allows to distinguish in policy files created by artd vs other
25# processes.
26tmpfs_domain(artd)
27
28# Allow testing userfaultfd support.
29userfaultfd_use(artd)
30
31# Read access to primary dex'es on writable partitions (e.g., /data/app/...).
32r_dir_file(artd, apk_data_file)
33
34# Read access to /vendor/app.
35r_dir_file(artd, vendor_app_file)
36
Jiakai Zhang2ce60a62022-06-07 15:20:58 +010037# Read/write access to all compilation artifacts generated on device for apps'
38# primary dex'es. (/data/dalvik-cache/..., /data/app/.../oat/..., etc.)
39allow artd dalvikcache_data_file:dir create_dir_perms;
40allow artd dalvikcache_data_file:file create_file_perms;
Jiakai Zhang76bfb7e2022-05-26 13:55:33 +010041
42# Read access to the ART APEX data directory.
43# Needed for reading the boot image generated on device.
44allow artd apex_module_data_file:dir { getattr search };
45r_dir_file(artd, apex_art_data_file)
46
47# Read access to /apex/apex-info-list.xml
48# Needed for getting APEX versions.
49allow artd apex_info_file:file r_file_perms;
Jiakai Zhang2ce60a62022-06-07 15:20:58 +010050
51# Allow getting root capabilities to bypass permission checks.
52# - "dac_override" and "dac_read_search" are for
53# - reading secondary dex'es in app data directories (reading primary dex'es
54# doesn't need root capabilities)
55# - managing (CRUD) compilation artifacts in both APK directories for primary
56# dex'es and in app data directories for secondary dex'es
57# - managing (CRUD) profile files for both primary dex'es and secondary dex'es
58# - "fowner" is for adjusting the file permissions of compilation artifacts and
59# profile files based on whether they include user data or not.
Jiakai Zhangc871c1c2022-07-19 21:29:31 +010060# - "chown" is for transferring the ownership of compilation artifacts and
61# profile files to the system or apps.
62allow artd self:global_capability_class_set { dac_override dac_read_search fowner chown };
63
64# Read/write access to profiles (/data/misc/profiles/{ref,cur}/...).
Jiakai Zhangff67b842022-09-23 20:59:42 +010065allow artd user_profile_data_file:dir rw_dir_perms;
Jiakai Zhangc871c1c2022-07-19 21:29:31 +010066allow artd user_profile_data_file:file create_file_perms;
67
68# Never allow running other binaries without a domain transition.
69# The only exception is art_exec. It is allowed to use the artd domain because
70# it is a thin wrapper that executes other binaries on behalf of artd.
71neverallow artd ~{art_exec_exec}:file execute_no_trans;
72allow artd art_exec_exec:file rx_file_perms;
73
74# Allow running other binaries in their own domains.
75domain_auto_trans(artd, profman_exec, profman)
76domain_auto_trans(artd, dex2oat_exec, dex2oat)
77
78# Allow sending sigkill to subprocesses.
79allow artd { profman dex2oat }:process sigkill;
Jiakai Zhang88e55832022-09-07 23:52:09 +010080
81# Allow reading process info (/proc/<pid>/...).
82# This is needed for getting CPU time and wall time spent on subprocesses.
83r_dir_file(artd, profman);
84r_dir_file(artd, dex2oat);