Orion Hodson | 8f75f76 | 2020-10-16 15:29:55 +0100 | [diff] [blame] | 1 | # odrefresh |
| 2 | type odrefresh, domain, coredomain; |
| 3 | type odrefresh_exec, system_file_type, exec_type, file_type; |
| 4 | |
| 5 | # Allow odrefresh to create files and directories for on device signing. |
| 6 | allow odrefresh apex_module_data_file:dir { getattr search }; |
| 7 | allow odrefresh apex_art_data_file:dir { create_dir_perms relabelfrom }; |
Orion Hodson | 46c2aad | 2021-03-01 15:03:26 +0000 | [diff] [blame] | 8 | allow odrefresh apex_art_data_file:file create_file_perms; |
Orion Hodson | 8f75f76 | 2020-10-16 15:29:55 +0100 | [diff] [blame] | 9 | |
Orion Hodson | 7c6b3eb | 2021-04-09 15:17:38 +0100 | [diff] [blame] | 10 | # Allow odrefresh to create data files (typically for metrics before statsd starts). |
| 11 | allow odrefresh odrefresh_data_file:dir create_dir_perms; |
| 12 | allow odrefresh odrefresh_data_file:file create_file_perms; |
| 13 | |
Lokesh Gidra | 06edcd8 | 2021-03-11 11:32:47 -0800 | [diff] [blame] | 14 | userfaultfd_use(odrefresh) |
| 15 | |
Orion Hodson | 8f75f76 | 2020-10-16 15:29:55 +0100 | [diff] [blame] | 16 | # Staging area labels (/data/misc/apexdata/com.android.art/staging). odrefresh |
| 17 | # sets up files here and passes file descriptors for dex2oat to write to. |
| 18 | allow odrefresh apex_art_staging_data_file:dir { create_dir_perms relabelto }; |
| 19 | allow odrefresh apex_art_staging_data_file:file create_file_perms; |
| 20 | |
| 21 | # Run dex2oat in its own sandbox. |
| 22 | domain_auto_trans(odrefresh, dex2oat_exec, dex2oat) |
| 23 | |
| 24 | # Run dexoptanalyzer in its own sandbox. |
| 25 | domain_auto_trans(odrefresh, dexoptanalyzer_exec, dexoptanalyzer) |
| 26 | |
Martijn Coenen | 6afdb72 | 2020-11-27 12:23:54 +0100 | [diff] [blame] | 27 | # Use devpts and fd from odsign (which exec()'s odrefresh) |
| 28 | allow odrefresh odsign_devpts:chr_file { read write }; |
| 29 | allow odrefresh odsign:fd use; |
| 30 | |
Orion Hodson | 8f75f76 | 2020-10-16 15:29:55 +0100 | [diff] [blame] | 31 | # Do not audit unused resources from parent processes (adb, shell, su). |
| 32 | # These appear to be unnecessary for odrefresh. |
| 33 | dontaudit odrefresh { adbd shell }:fd use; |
| 34 | dontaudit odrefresh devpts:chr_file rw_file_perms; |
| 35 | dontaudit odrefresh adbd:unix_stream_socket { getattr read write }; |
| 36 | |
| 37 | # Allow odrefresh to read /apex/apex-info-list.xml to determine |
| 38 | # whether current apex is in /system or /data. |
| 39 | allow odrefresh apex_info_file:file r_file_perms; |
| 40 | |
| 41 | # No other processes should be creating files in the staging area. |
| 42 | neverallow { domain -init -odrefresh } apex_art_staging_data_file:file open; |
Orion Hodson | 7c6b3eb | 2021-04-09 15:17:38 +0100 | [diff] [blame] | 43 | |
| 44 | # No processes other than init, odrefresh and system_server access |
| 45 | # odrefresh_data_files. |
| 46 | neverallow { domain -init -odrefresh -system_server } odrefresh_data_file:dir *; |
| 47 | neverallow { domain -init -odrefresh -system_server } odrefresh_data_file:file *; |
Nicolas Geoffray | efef689 | 2021-04-16 09:26:38 +0100 | [diff] [blame] | 48 | |
| 49 | # Allow updating boot animation status. |
Nicolas Geoffray | 6a31147 | 2021-04-28 13:57:11 +0100 | [diff] [blame] | 50 | set_prop(odrefresh, bootanim_system_prop) |
Calin Juravle | 0b2ca6c | 2021-05-18 15:33:08 -0700 | [diff] [blame^] | 51 | |
| 52 | # Allow query ART device config properties |
| 53 | get_prop(odrefresh, device_config_runtime_native_prop) |
| 54 | get_prop(odrefresh, device_config_runtime_native_boot_prop) |