xref: /aosp_15_r20/system/sepolicy/prebuilts/api/31.0/private/odrefresh.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# odrefresh
2*e4a36f41SAndroid Build Coastguard Workertype odrefresh, domain, coredomain;
3*e4a36f41SAndroid Build Coastguard Workertype odrefresh_exec, system_file_type, exec_type, file_type;
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Worker# Allow odrefresh to create files and directories for on device signing.
6*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_module_data_file:dir { getattr search };
7*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_art_data_file:dir { create_dir_perms relabelfrom };
8*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_art_data_file:file create_file_perms;
9*e4a36f41SAndroid Build Coastguard Worker
10*e4a36f41SAndroid Build Coastguard Worker# Allow odrefresh to create data files (typically for metrics before statsd starts).
11*e4a36f41SAndroid Build Coastguard Workerallow odrefresh odrefresh_data_file:dir create_dir_perms;
12*e4a36f41SAndroid Build Coastguard Workerallow odrefresh odrefresh_data_file:file create_file_perms;
13*e4a36f41SAndroid Build Coastguard Worker
14*e4a36f41SAndroid Build Coastguard Workeruserfaultfd_use(odrefresh)
15*e4a36f41SAndroid Build Coastguard Worker
16*e4a36f41SAndroid Build Coastguard Worker# Staging area labels (/data/misc/apexdata/com.android.art/staging). odrefresh
17*e4a36f41SAndroid Build Coastguard Worker# sets up files here and passes file descriptors for dex2oat to write to.
18*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_art_staging_data_file:dir { create_dir_perms relabelto };
19*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_art_staging_data_file:file create_file_perms;
20*e4a36f41SAndroid Build Coastguard Worker
21*e4a36f41SAndroid Build Coastguard Worker# Run dex2oat in its own sandbox.
22*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(odrefresh, dex2oat_exec, dex2oat)
23*e4a36f41SAndroid Build Coastguard Worker
24*e4a36f41SAndroid Build Coastguard Worker# Allow odrefresh to kill dex2oat if compilation times out.
25*e4a36f41SAndroid Build Coastguard Workerallow odrefresh dex2oat:process sigkill;
26*e4a36f41SAndroid Build Coastguard Worker
27*e4a36f41SAndroid Build Coastguard Worker# Run dexoptanalyzer in its own sandbox.
28*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(odrefresh, dexoptanalyzer_exec, dexoptanalyzer)
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker# Allow odrefresh to kill dexoptanalyzer if analysis times out.
31*e4a36f41SAndroid Build Coastguard Workerallow odrefresh dexoptanalyzer:process sigkill;
32*e4a36f41SAndroid Build Coastguard Worker
33*e4a36f41SAndroid Build Coastguard Worker# Use devpts and fd from odsign (which exec()'s odrefresh)
34*e4a36f41SAndroid Build Coastguard Workerallow odrefresh odsign_devpts:chr_file { read write };
35*e4a36f41SAndroid Build Coastguard Workerallow odrefresh odsign:fd use;
36*e4a36f41SAndroid Build Coastguard Worker
37*e4a36f41SAndroid Build Coastguard Worker# Do not audit unused resources from parent processes (adb, shell, su).
38*e4a36f41SAndroid Build Coastguard Worker# These appear to be unnecessary for odrefresh.
39*e4a36f41SAndroid Build Coastguard Workerdontaudit odrefresh { adbd shell }:fd use;
40*e4a36f41SAndroid Build Coastguard Workerdontaudit odrefresh devpts:chr_file rw_file_perms;
41*e4a36f41SAndroid Build Coastguard Workerdontaudit odrefresh adbd:unix_stream_socket { getattr read write };
42*e4a36f41SAndroid Build Coastguard Worker
43*e4a36f41SAndroid Build Coastguard Worker# Allow odrefresh to read /apex/apex-info-list.xml to determine
44*e4a36f41SAndroid Build Coastguard Worker# whether current apex is in /system or /data.
45*e4a36f41SAndroid Build Coastguard Workerallow odrefresh apex_info_file:file r_file_perms;
46*e4a36f41SAndroid Build Coastguard Worker
47*e4a36f41SAndroid Build Coastguard Worker# No other processes should be creating files in the staging area.
48*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -odrefresh } apex_art_staging_data_file:file open;
49*e4a36f41SAndroid Build Coastguard Worker
50*e4a36f41SAndroid Build Coastguard Worker# No processes other than init, odrefresh and system_server access
51*e4a36f41SAndroid Build Coastguard Worker# odrefresh_data_files.
52*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -odrefresh -system_server } odrefresh_data_file:dir *;
53*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -odrefresh -system_server } odrefresh_data_file:file *;
54*e4a36f41SAndroid Build Coastguard Worker
55*e4a36f41SAndroid Build Coastguard Worker# Allow updating boot animation status.
56*e4a36f41SAndroid Build Coastguard Workerset_prop(odrefresh, bootanim_system_prop)
57*e4a36f41SAndroid Build Coastguard Worker
58*e4a36f41SAndroid Build Coastguard Worker# Allow query ART device config properties
59*e4a36f41SAndroid Build Coastguard Workerget_prop(odrefresh, device_config_runtime_native_prop)
60*e4a36f41SAndroid Build Coastguard Workerget_prop(odrefresh, device_config_runtime_native_boot_prop)
61