Victor Hsieh | f97cc1f | 2021-11-30 14:43:47 -0800 | [diff] [blame] | 1 | # odrefresh |
| 2 | type odrefresh, domain, coredomain; |
| 3 | type odrefresh_exec, system_file_type, exec_type, file_type; |
| 4 | |
| 5 | # Run dex2oat in its own sandbox. |
| 6 | domain_auto_trans(odrefresh, dex2oat_exec, dex2oat) |
| 7 | |
| 8 | # Allow odrefresh to kill dex2oat if compilation times out. |
| 9 | allow odrefresh dex2oat:process sigkill; |
| 10 | |
Victor Hsieh | 6c874fb | 2022-03-23 17:19:39 -0700 | [diff] [blame] | 11 | userfaultfd_use(odrefresh) |
| 12 | |
| 13 | # Allow odrefresh to read /apex/apex-info-list.xml to gather information of |
| 14 | # the current APEXes. |
| 15 | allow odrefresh apex_info_file:file r_file_perms; |
| 16 | |
| 17 | # The policies above are mirrored from Android's, while the below are tailored for using in CompOS. |
| 18 | |
Victor Hsieh | f97cc1f | 2021-11-30 14:43:47 -0800 | [diff] [blame] | 19 | # Allow odrefresh to read/write/lookup files/directories on authfs. |
| 20 | allow odrefresh authfs_fuse:file create_file_perms; |
| 21 | allow odrefresh authfs_fuse:dir create_dir_perms; |
| 22 | |
| 23 | # Allow odrefresh to check the parent directory exists. |
| 24 | allow odrefresh authfs_data_file:dir { search getattr }; |
| 25 | |
Victor Hsieh | 1494f6b | 2021-12-08 14:52:06 -0800 | [diff] [blame] | 26 | # Minijail uses pipe for the parent process to signal the child (as a fallback |
| 27 | # mechanism, since Android does not support minijail's preload). |
| 28 | # TODO(196109647): We can probably remove this once the minijail preload is |
| 29 | # supported on Android. |
| 30 | allow odrefresh compos:fifo_file read; |
| 31 | |
Victor Hsieh | a341025 | 2021-12-15 16:48:07 -0800 | [diff] [blame] | 32 | # Allow using FDs from the parent. It's possible that this could be avoided, |
| 33 | # if we close fd 0-2 before execute. But minijial replaces them with /dev/null |
| 34 | # (unless specified otherwise). Without allowing the use, the execution will |
| 35 | # fail immediately. See b/210909688. |
| 36 | allow odrefresh compos:fd use; |
Victor Hsieh | e2156d0 | 2022-02-22 23:05:06 +0000 | [diff] [blame] | 37 | |
Victor Hsieh | 7026c10 | 2022-05-13 15:22:16 -0700 | [diff] [blame] | 38 | # Allow odrefresh to read all dalvik system properties. odrefresh needs to record the relevant ones |
| 39 | # in the output for later verification check. |
Jiakai Zhang | 22fb5c7 | 2023-03-30 15:50:05 +0100 | [diff] [blame] | 40 | get_prop(odrefresh, dalvik_config_prop_type) |
Victor Hsieh | 7026c10 | 2022-05-13 15:22:16 -0700 | [diff] [blame] | 41 | get_prop(odrefresh, device_config_runtime_native_boot_prop) |
| 42 | |
| 43 | # Silently ignore the write to properties, e.g. for setting boot animation progress. |
Victor Hsieh | e2156d0 | 2022-02-22 23:05:06 +0000 | [diff] [blame] | 44 | dontaudit odrefresh property_socket:sock_file write; |