1*e4a36f41SAndroid Build Coastguard Workertypeattribute recovery_persist coredomain; 2*e4a36f41SAndroid Build Coastguard Worker 3*e4a36f41SAndroid Build Coastguard Workerinit_daemon_domain(recovery_persist) 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist pstorefs:dir search; 6*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist pstorefs:file r_file_perms; 7*e4a36f41SAndroid Build Coastguard Worker 8*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist recovery_data_file:file create_file_perms; 9*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist recovery_data_file:dir create_dir_perms; 10*e4a36f41SAndroid Build Coastguard Worker 11*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist cache_file:dir search; 12*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist cache_file:lnk_file read; 13*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist cache_recovery_file:dir rw_dir_perms; 14*e4a36f41SAndroid Build Coastguard Workerallow recovery_persist cache_recovery_file:file { r_file_perms unlink }; 15*e4a36f41SAndroid Build Coastguard Worker 16*e4a36f41SAndroid Build Coastguard Worker### 17*e4a36f41SAndroid Build Coastguard Worker### Neverallow rules 18*e4a36f41SAndroid Build Coastguard Worker### 19*e4a36f41SAndroid Build Coastguard Worker### recovery_persist should NEVER do any of this 20*e4a36f41SAndroid Build Coastguard Worker 21*e4a36f41SAndroid Build Coastguard Worker# Block device access. 22*e4a36f41SAndroid Build Coastguard Workerneverallow recovery_persist dev_type:blk_file { read write }; 23*e4a36f41SAndroid Build Coastguard Worker 24*e4a36f41SAndroid Build Coastguard Worker# ptrace any other app 25*e4a36f41SAndroid Build Coastguard Workerneverallow recovery_persist domain:process ptrace; 26*e4a36f41SAndroid Build Coastguard Worker 27*e4a36f41SAndroid Build Coastguard Worker# Write to /system. 28*e4a36f41SAndroid Build Coastguard Workerneverallow recovery_persist system_file_type:dir_file_class_set write; 29*e4a36f41SAndroid Build Coastguard Worker 30*e4a36f41SAndroid Build Coastguard Worker# Write to files in /data/data 31*e4a36f41SAndroid Build Coastguard Workerneverallow recovery_persist { app_data_file_type system_data_file }:dir_file_class_set write; 32*e4a36f41SAndroid Build Coastguard Worker 33*e4a36f41SAndroid Build Coastguard Worker# recovery_persist is not allowed to write anywhere other than recovery_data_file 34*e4a36f41SAndroid Build Coastguard Workerneverallow recovery_persist { 35*e4a36f41SAndroid Build Coastguard Worker file_type 36*e4a36f41SAndroid Build Coastguard Worker -recovery_data_file 37*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-coredump_file') 38*e4a36f41SAndroid Build Coastguard Worker with_native_coverage(`-method_trace_data_file') 39*e4a36f41SAndroid Build Coastguard Worker}:file write; 40