blob: 47ff77fc2b051e8db0ad4b23587cbc0440a76dd5 [file] [log] [blame]
Andreas Gampe6d5baca2019-02-26 13:13:28 -08001# dex2oat
2type dex2oat, domain, coredomain;
3type dex2oat_exec, system_file_type, exec_type, file_type;
4
Lokesh Gidra06edcd82021-03-11 11:32:47 -08005userfaultfd_use(dex2oat)
6
Andreas Gampe6d5baca2019-02-26 13:13:28 -08007r_dir_file(dex2oat, apk_data_file)
8# Access to /vendor/app
9r_dir_file(dex2oat, vendor_app_file)
10# Access /vendor/framework
11allow dex2oat vendor_framework_file:dir { getattr search };
12allow dex2oat vendor_framework_file:file { getattr open read map };
13
14allow dex2oat tmpfs:file { read getattr map };
15
16r_dir_file(dex2oat, dalvikcache_data_file)
17allow dex2oat dalvikcache_data_file:file write;
Andreas Gampe6d5baca2019-02-26 13:13:28 -080018allow dex2oat installd:fd use;
19
20# Acquire advisory lock on /system/framework/arm/*
21allow dex2oat system_file:file lock;
22
23# Read already open asec_apk_file file descriptors passed by installd.
24# Also allow reading unlabeled files, to allow for upgrading forward
25# locked APKs.
26allow dex2oat asec_apk_file:file { read map };
27allow dex2oat unlabeled:file { read map };
28allow dex2oat oemfs:file { read map };
29allow dex2oat apk_tmp_file:dir search;
30allow dex2oat apk_tmp_file:file r_file_perms;
31allow dex2oat user_profile_data_file:file { getattr read lock map };
32
33# Allow dex2oat to compile app's secondary dex files which were reported back to
34# the framework.
35allow dex2oat { privapp_data_file app_data_file }:file { getattr read write lock map };
36
Orion Hodson8f75f762020-10-16 15:29:55 +010037# Allow dex2oat to find files and directories under /data/misc/apexdata/com.android.runtime.
38allow dex2oat apex_module_data_file:dir search;
39
40# Allow dex2oat to use file descriptors passed from odrefresh.
41allow dex2oat odrefresh:fd use;
42
Martijn Coenen6afdb722020-11-27 12:23:54 +010043# Allow dex2oat to use devpts and file descriptors passed from odsign
44allow dex2oat odsign_devpts:chr_file { read write };
45allow dex2oat odsign:fd use;
46
Orion Hodson8f75f762020-10-16 15:29:55 +010047# Allow dex2oat to write to file descriptors from odrefresh for files
48# in the staging area.
49allow dex2oat apex_art_staging_data_file:dir r_dir_perms;
50allow dex2oat apex_art_staging_data_file:file { getattr map read write unlink };
51
52# Allow dex2oat to read artifacts from odrefresh.
53allow dex2oat apex_art_data_file:dir r_dir_perms;
54allow dex2oat apex_art_data_file:file r_file_perms;
55
Roland Levillaind7227d82021-02-02 15:27:06 +000056# Allow dex2oat to read runtime native flag properties.
57get_prop(dex2oat, device_config_runtime_native_prop)
58get_prop(dex2oat, device_config_runtime_native_boot_prop)
59
Andreas Gampe6d5baca2019-02-26 13:13:28 -080060##################
61# A/B OTA Dexopt #
62##################
63
64# Allow dex2oat to use file descriptors from otapreopt.
65allow dex2oat postinstall_dexopt:fd use;
66
Roland Levillain66f40a82019-03-13 18:52:23 +000067# Allow dex2oat to read files under /postinstall (e.g. APKs under /system, /system/bin/linker).
68allow dex2oat postinstall_file:dir r_dir_perms;
Andreas Gampe6d5baca2019-02-26 13:13:28 -080069allow dex2oat postinstall_file:filesystem getattr;
70allow dex2oat postinstall_file:lnk_file { getattr read };
Andreas Gampe6d5baca2019-02-26 13:13:28 -080071allow dex2oat postinstall_file:file read;
72# Allow dex2oat to use libraries under /postinstall/system (e.g. /system/lib/libc.so).
73# TODO(b/120266448): Remove when Bionic libraries are part of the Runtime APEX.
74allow dex2oat postinstall_file:file { execute getattr open };
75
76# Allow dex2oat access to /postinstall/apex.
77allow dex2oat postinstall_apex_mnt_dir:dir { getattr search };
78
79# Allow dex2oat access to files in /data/ota.
80allow dex2oat ota_data_file:dir ra_dir_perms;
81allow dex2oat ota_data_file:file r_file_perms;
82
83# Create and read symlinks in /data/ota/dalvik-cache. This is required for PIC mode boot images,
84# where the oat file is symlinked to the original file in /system.
85allow dex2oat ota_data_file:lnk_file { create read };
86
87# It would be nice to tie this down, but currently, because of how images are written, we can't
88# pass file descriptors for the preopted boot image to dex2oat. So dex2oat needs to be able to
89# create them itself (and make them world-readable).
90allow dex2oat ota_data_file:file { create w_file_perms setattr };
91
Andreas Gampeae127d82019-02-07 16:26:00 -080092###############
93# APEX Update #
94###############
95
96# /dev/zero is inherited.
97allow dex2oat apexd:fd use;
98
99# Allow dex2oat to use file descriptors from preinstall.
Andreas Gampeae127d82019-02-07 16:26:00 -0800100
Andreas Gampe6d5baca2019-02-26 13:13:28 -0800101##############
102# Neverallow #
103##############
104
105neverallow dex2oat { privapp_data_file app_data_file }:notdevfile_class_set open;