blob: b08462e22cd1da13e9a92eed397b4b25b1606800 [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
5r_dir_file(dex2oat, apk_data_file)
6# Access to /vendor/app
7r_dir_file(dex2oat, vendor_app_file)
8# Access /vendor/framework
9allow dex2oat vendor_framework_file:dir { getattr search };
10allow dex2oat vendor_framework_file:file { getattr open read map };
11
12allow dex2oat tmpfs:file { read getattr map };
13
14r_dir_file(dex2oat, dalvikcache_data_file)
15allow dex2oat dalvikcache_data_file:file write;
Andreas Gampe6d5baca2019-02-26 13:13:28 -080016allow dex2oat installd:fd use;
17
18# Acquire advisory lock on /system/framework/arm/*
19allow dex2oat system_file:file lock;
Jeff Vander Stoep4c0259d2021-03-05 19:54:30 +010020allow dex2oat postinstall_file:file lock;
Andreas Gampe6d5baca2019-02-26 13:13:28 -080021
22# Read already open asec_apk_file file descriptors passed by installd.
23# Also allow reading unlabeled files, to allow for upgrading forward
24# locked APKs.
25allow dex2oat asec_apk_file:file { read map };
26allow dex2oat unlabeled:file { read map };
27allow dex2oat oemfs:file { read map };
28allow dex2oat apk_tmp_file:dir search;
29allow dex2oat apk_tmp_file:file r_file_perms;
30allow dex2oat user_profile_data_file:file { getattr read lock map };
31
32# Allow dex2oat to compile app's secondary dex files which were reported back to
33# the framework.
34allow dex2oat { privapp_data_file app_data_file }:file { getattr read write lock map };
35
Orion Hodson8f75f762020-10-16 15:29:55 +010036# Allow dex2oat to find files and directories under /data/misc/apexdata/com.android.runtime.
37allow dex2oat apex_module_data_file:dir search;
38
39# Allow dex2oat to use file descriptors passed from odrefresh.
40allow dex2oat odrefresh:fd use;
41
Martijn Coenen6afdb722020-11-27 12:23:54 +010042# Allow dex2oat to use devpts and file descriptors passed from odsign
43allow dex2oat odsign_devpts:chr_file { read write };
44allow dex2oat odsign:fd use;
45
Orion Hodson8f75f762020-10-16 15:29:55 +010046# Allow dex2oat to write to file descriptors from odrefresh for files
47# in the staging area.
48allow dex2oat apex_art_staging_data_file:dir r_dir_perms;
49allow dex2oat apex_art_staging_data_file:file { getattr map read write unlink };
50
51# Allow dex2oat to read artifacts from odrefresh.
52allow dex2oat apex_art_data_file:dir r_dir_perms;
53allow dex2oat apex_art_data_file:file r_file_perms;
54
Roland Levillaind7227d82021-02-02 15:27:06 +000055# Allow dex2oat to read runtime native flag properties.
56get_prop(dex2oat, device_config_runtime_native_prop)
57get_prop(dex2oat, device_config_runtime_native_boot_prop)
58
Andreas Gampe6d5baca2019-02-26 13:13:28 -080059##################
60# A/B OTA Dexopt #
61##################
62
63# Allow dex2oat to use file descriptors from otapreopt.
64allow dex2oat postinstall_dexopt:fd use;
65
Roland Levillain66f40a82019-03-13 18:52:23 +000066# Allow dex2oat to read files under /postinstall (e.g. APKs under /system, /system/bin/linker).
67allow dex2oat postinstall_file:dir r_dir_perms;
Andreas Gampe6d5baca2019-02-26 13:13:28 -080068allow dex2oat postinstall_file:filesystem getattr;
69allow dex2oat postinstall_file:lnk_file { getattr read };
Andreas Gampe6d5baca2019-02-26 13:13:28 -080070allow dex2oat postinstall_file:file read;
71# Allow dex2oat to use libraries under /postinstall/system (e.g. /system/lib/libc.so).
72# TODO(b/120266448): Remove when Bionic libraries are part of the Runtime APEX.
73allow dex2oat postinstall_file:file { execute getattr open };
74
75# Allow dex2oat access to /postinstall/apex.
76allow dex2oat postinstall_apex_mnt_dir:dir { getattr search };
77
78# Allow dex2oat access to files in /data/ota.
79allow dex2oat ota_data_file:dir ra_dir_perms;
80allow dex2oat ota_data_file:file r_file_perms;
81
82# Create and read symlinks in /data/ota/dalvik-cache. This is required for PIC mode boot images,
83# where the oat file is symlinked to the original file in /system.
84allow dex2oat ota_data_file:lnk_file { create read };
85
86# It would be nice to tie this down, but currently, because of how images are written, we can't
87# pass file descriptors for the preopted boot image to dex2oat. So dex2oat needs to be able to
88# create them itself (and make them world-readable).
89allow dex2oat ota_data_file:file { create w_file_perms setattr };
90
Andreas Gampeae127d82019-02-07 16:26:00 -080091###############
92# APEX Update #
93###############
94
95# /dev/zero is inherited.
96allow dex2oat apexd:fd use;
97
98# Allow dex2oat to use file descriptors from preinstall.
Andreas Gampeae127d82019-02-07 16:26:00 -080099
Andreas Gampe6d5baca2019-02-26 13:13:28 -0800100##############
101# Neverallow #
102##############
103
104neverallow dex2oat { privapp_data_file app_data_file }:notdevfile_class_set open;