Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute profman coredomain; |
Jiakai Zhang | f7dcc53 | 2024-07-04 15:59:49 +0100 | [diff] [blame] | 2 | typeattribute profman artd_subprocess_type; |
Jiakai Zhang | c871c1c | 2022-07-19 21:29:31 +0100 | [diff] [blame] | 3 | |
| 4 | # Allow profman to read APKs and profile files next to them by FDs passed from |
| 5 | # other programs. In addition, allow profman to acquire flocks on those files. |
| 6 | allow profman { |
| 7 | system_file |
| 8 | apk_data_file |
TYM Tsai | e6cc2d4 | 2024-08-27 10:33:42 +0800 | [diff] [blame] | 9 | apk_tmp_file |
Jiakai Zhang | c871c1c | 2022-07-19 21:29:31 +0100 | [diff] [blame] | 10 | vendor_app_file |
| 11 | }:file { getattr read map lock }; |
| 12 | |
| 13 | # Allow profman to use file descriptors passed from privileged programs. |
| 14 | allow profman { artd installd }:fd use; |
Jiakai Zhang | 8ff6c55 | 2023-10-12 13:48:00 +0000 | [diff] [blame] | 15 | |
| 16 | # Allow profman to read from memfd created by artd. |
| 17 | # profman needs to read the embedded profile that artd extracts from an APK, |
| 18 | # which is passed by a memfd. |
| 19 | allow profman artd_tmpfs:file { getattr read map lock }; |
Inseob Kim | 75806ef | 2024-03-27 17:18:41 +0900 | [diff] [blame] | 20 | |
| 21 | allow profman user_profile_data_file:file { getattr read write lock map }; |
| 22 | |
| 23 | # Dumping profile info opens the application APK file for pretty printing. |
| 24 | allow profman asec_apk_file:file { read map }; |
| 25 | allow profman apk_data_file:file { getattr read map }; |
| 26 | allow profman apk_data_file:dir { getattr read search }; |
TYM Tsai | e6cc2d4 | 2024-08-27 10:33:42 +0800 | [diff] [blame] | 27 | allow profman apk_tmp_file:dir { getattr read search }; |
Inseob Kim | 75806ef | 2024-03-27 17:18:41 +0900 | [diff] [blame] | 28 | |
| 29 | allow profman oemfs:file { read map }; |
| 30 | # Reading an APK opens a ZipArchive, which unpack to tmpfs. |
| 31 | allow profman tmpfs:file { read map }; |
| 32 | allow profman profman_dump_data_file:file { write map }; |
| 33 | |
| 34 | # Allow profman to analyze profiles for the secondary dex files. These |
| 35 | # are application dex files reported back to the framework when using |
| 36 | # BaseDexClassLoader. |
| 37 | allow profman { privapp_data_file app_data_file }:file { getattr read write lock map }; |
| 38 | allow profman { privapp_data_file app_data_file }:dir { getattr read search }; |
| 39 | |
| 40 | # Allow query ART device config properties |
| 41 | get_prop(profman, device_config_runtime_native_prop) |
| 42 | get_prop(profman, device_config_runtime_native_boot_prop) |
| 43 | |
| 44 | ### |
| 45 | ### neverallow rules |
| 46 | ### |
| 47 | |
| 48 | neverallow profman app_data_file_type:notdevfile_class_set open; |