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