xref: /aosp_15_r20/system/sepolicy/prebuilts/api/31.0/private/logpersist.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workertypeattribute logpersist coredomain;
2*e4a36f41SAndroid Build Coastguard Worker
3*e4a36f41SAndroid Build Coastguard Worker# android debug log storage in logpersist domains (eng and userdebug only)
4*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
5*e4a36f41SAndroid Build Coastguard Worker
6*e4a36f41SAndroid Build Coastguard Worker  r_dir_file(logpersist, cgroup)
7*e4a36f41SAndroid Build Coastguard Worker  r_dir_file(logpersist, cgroup_v2)
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Worker  allow logpersist misc_logd_file:file create_file_perms;
10*e4a36f41SAndroid Build Coastguard Worker  allow logpersist misc_logd_file:dir rw_dir_perms;
11*e4a36f41SAndroid Build Coastguard Worker
12*e4a36f41SAndroid Build Coastguard Worker  allow logpersist self:global_capability_class_set sys_nice;
13*e4a36f41SAndroid Build Coastguard Worker  allow logpersist pstorefs:dir search;
14*e4a36f41SAndroid Build Coastguard Worker  allow logpersist pstorefs:file r_file_perms;
15*e4a36f41SAndroid Build Coastguard Worker
16*e4a36f41SAndroid Build Coastguard Worker  control_logd(logpersist)
17*e4a36f41SAndroid Build Coastguard Worker  unix_socket_connect(logpersist, logdr, logd)
18*e4a36f41SAndroid Build Coastguard Worker  read_runtime_log_tags(logpersist)
19*e4a36f41SAndroid Build Coastguard Worker
20*e4a36f41SAndroid Build Coastguard Worker')
21*e4a36f41SAndroid Build Coastguard Worker
22*e4a36f41SAndroid Build Coastguard Worker# logpersist is allowed to write to /data/misc/log for userdebug and eng builds
23*e4a36f41SAndroid Build Coastguard Workerneverallow logpersist {
24*e4a36f41SAndroid Build Coastguard Worker  file_type
25*e4a36f41SAndroid Build Coastguard Worker  userdebug_or_eng(`-misc_logd_file -coredump_file')
26*e4a36f41SAndroid Build Coastguard Worker  with_native_coverage(`-method_trace_data_file')
27*e4a36f41SAndroid Build Coastguard Worker}:file { create write append };
28*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -dumpstate -incidentd userdebug_or_eng(`-logpersist -logd') } misc_logd_file:file no_rw_file_perms;
29*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init userdebug_or_eng(`-logpersist -logd') } misc_logd_file:file no_w_file_perms;
30*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init userdebug_or_eng(`-logpersist -logd') } misc_logd_file:dir { add_name link relabelfrom remove_name rename reparent rmdir write };
31