1# android user-space log manager 2type logd, domain, mlstrustedsubject; 3type logd_exec, exec_type, file_type; 4 5init_daemon_domain(logd) 6 7allow logd self:capability { setuid setgid sys_nice audit_control }; 8allow logd self:capability2 syslog; 9allow logd self:netlink_audit_socket { create_socket_perms nlmsg_write }; 10allow logd kernel:system syslog_read; 11allow logd kmsg_device:chr_file w_file_perms; 12allow logd system_data_file:file r_file_perms; 13allow logd misc_logd_file:file create_file_perms; 14allow logd misc_logd_file:dir rw_dir_perms; 15allow logd pstorefs:dir search; 16allow logd pstorefs:file r_file_perms; 17 18r_dir_file(logd, domain) 19 20allow logd kernel:system syslog_mod; 21 22control_logd(logd) 23 24# case where logpersistd is actually logcat -f in logd context (nee: logcatd) 25userdebug_or_eng(` 26 unix_socket_connect(logd, logdr, logd) 27') 28 29### 30### Neverallow rules 31### 32### logd should NEVER do any of this 33 34# Block device access. 35neverallow logd dev_type:blk_file { read write }; 36 37# ptrace any other app 38neverallow logd domain:process ptrace; 39 40# Write to /system. 41neverallow logd system_file:dir_file_class_set write; 42 43# Write to files in /data/data or system files on /data 44neverallow logd { app_data_file system_data_file }:dir_file_class_set write; 45