1*e4a36f41SAndroid Build Coastguard Worker# dexoptanalyzer 2*e4a36f41SAndroid Build Coastguard Workertype dexoptanalyzer, domain, coredomain, mlstrustedsubject; 3*e4a36f41SAndroid Build Coastguard Workertype dexoptanalyzer_exec, system_file_type, exec_type, file_type; 4*e4a36f41SAndroid Build Coastguard Workertype dexoptanalyzer_tmpfs, file_type; 5*e4a36f41SAndroid Build Coastguard Worker 6*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dexoptanalyzer, apk_data_file) 7*e4a36f41SAndroid Build Coastguard Worker# Access to /vendor/app 8*e4a36f41SAndroid Build Coastguard Workerr_dir_file(dexoptanalyzer, vendor_app_file) 9*e4a36f41SAndroid Build Coastguard Worker 10*e4a36f41SAndroid Build Coastguard Worker# Reading an APK opens a ZipArchive, which unpack to tmpfs. 11*e4a36f41SAndroid Build Coastguard Worker# Use tmpfs_domain() which will give tmpfs files created by dexoptanalyzer their 12*e4a36f41SAndroid Build Coastguard Worker# own label, which differs from other labels created by other processes. 13*e4a36f41SAndroid Build Coastguard Worker# This allows to distinguish in policy files created by dexoptanalyzer vs other 14*e4a36f41SAndroid Build Coastguard Worker# processes. 15*e4a36f41SAndroid Build Coastguard Workertmpfs_domain(dexoptanalyzer) 16*e4a36f41SAndroid Build Coastguard Worker 17*e4a36f41SAndroid Build Coastguard Workeruserfaultfd_use(dexoptanalyzer) 18*e4a36f41SAndroid Build Coastguard Worker 19*e4a36f41SAndroid Build Coastguard Worker# Allow dexoptanalyzer to read files in the dalvik cache. 20*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer dalvikcache_data_file:dir { getattr search }; 21*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer dalvikcache_data_file:file r_file_perms; 22*e4a36f41SAndroid Build Coastguard Worker 23*e4a36f41SAndroid Build Coastguard Worker# Read symlinks in /data/dalvik-cache. This is required for PIC mode boot 24*e4a36f41SAndroid Build Coastguard Worker# app_data_file the oat file is symlinked to the original file in /system. 25*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer dalvikcache_data_file:lnk_file read; 26*e4a36f41SAndroid Build Coastguard Worker 27*e4a36f41SAndroid Build Coastguard Worker# Allow dexoptanalyzer to read files in the ART APEX data directory. 28*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer { apex_art_data_file apex_module_data_file }:dir { getattr search }; 29*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer apex_art_data_file:file r_file_perms; 30*e4a36f41SAndroid Build Coastguard Worker 31*e4a36f41SAndroid Build Coastguard Worker# Allow dexoptanalyzer to use file descriptors from odrefresh. 32*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer odrefresh:fd use; 33*e4a36f41SAndroid Build Coastguard Worker 34*e4a36f41SAndroid Build Coastguard Worker# Use devpts and fd from odsign (which exec()'s odrefresh) 35*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer odsign:fd use; 36*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer odsign_devpts:chr_file { read write }; 37*e4a36f41SAndroid Build Coastguard Worker 38*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer installd:fd use; 39*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer installd:fifo_file { getattr write }; 40*e4a36f41SAndroid Build Coastguard Worker 41*e4a36f41SAndroid Build Coastguard Worker# Acquire advisory lock on /system/framework/arm/* 42*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer system_file:file lock; 43*e4a36f41SAndroid Build Coastguard Worker 44*e4a36f41SAndroid Build Coastguard Worker# Allow reading secondary dex files that were reported by the app to the 45*e4a36f41SAndroid Build Coastguard Worker# package manager. 46*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer { privapp_data_file app_data_file }:file { getattr read map }; 47*e4a36f41SAndroid Build Coastguard Worker 48*e4a36f41SAndroid Build Coastguard Worker# Allow testing /data/user/0 which symlinks to /data/data 49*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer system_data_file:lnk_file { getattr }; 50*e4a36f41SAndroid Build Coastguard Worker 51*e4a36f41SAndroid Build Coastguard Worker# Allow query ART device config properties 52*e4a36f41SAndroid Build Coastguard Workerget_prop(dexoptanalyzer, device_config_runtime_native_prop) 53*e4a36f41SAndroid Build Coastguard Workerget_prop(dexoptanalyzer, device_config_runtime_native_boot_prop) 54*e4a36f41SAndroid Build Coastguard Worker 55*e4a36f41SAndroid Build Coastguard Worker# Allow dexoptanalyzer to read /apex/apex-info-list.xml 56*e4a36f41SAndroid Build Coastguard Workerallow dexoptanalyzer apex_info_file:file r_file_perms; 57