2013-11-13 00:34:52 +01:00
|
|
|
# android user-space log manager
|
2015-11-03 18:54:39 +01:00
|
|
|
type logd, domain, domain_deprecated, mlstrustedsubject;
|
2013-11-13 00:34:52 +01:00
|
|
|
type logd_exec, exec_type, file_type;
|
|
|
|
|
|
|
|
init_daemon_domain(logd)
|
|
|
|
|
2016-01-28 04:23:10 +01:00
|
|
|
# Read access to pseudo filesystems.
|
|
|
|
r_dir_file(logd, proc)
|
|
|
|
r_dir_file(logd, proc_net)
|
|
|
|
|
2014-04-01 20:02:57 +02:00
|
|
|
allow logd self:capability { setuid setgid sys_nice audit_control };
|
|
|
|
allow logd self:capability2 syslog;
|
|
|
|
allow logd self:netlink_audit_socket { create_socket_perms nlmsg_write };
|
|
|
|
allow logd kernel:system syslog_read;
|
2014-04-07 23:04:30 +02:00
|
|
|
allow logd kmsg_device:chr_file w_file_perms;
|
2015-03-10 21:46:37 +01:00
|
|
|
allow logd system_data_file:file r_file_perms;
|
2015-09-22 01:22:21 +02:00
|
|
|
# logpersist is only allowed on userdebug and eng builds
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow logd misc_logd_file:file create_file_perms;
|
|
|
|
allow logd misc_logd_file:dir rw_dir_perms;
|
|
|
|
')
|
2015-05-27 00:12:45 +02:00
|
|
|
allow logd pstorefs:dir search;
|
|
|
|
allow logd pstorefs:file r_file_perms;
|
2013-11-13 00:34:52 +01:00
|
|
|
|
2016-01-04 16:20:45 +01:00
|
|
|
# Access device logging gating property
|
|
|
|
get_prop(logd, device_logging_prop)
|
|
|
|
|
2013-11-13 00:34:52 +01:00
|
|
|
r_dir_file(logd, domain)
|
|
|
|
|
2014-10-16 00:49:37 +02:00
|
|
|
allow logd kernel:system syslog_mod;
|
|
|
|
|
2015-03-10 21:46:37 +01:00
|
|
|
control_logd(logd)
|
|
|
|
|
2015-05-27 00:12:45 +02:00
|
|
|
# case where logpersistd is actually logcat -f in logd context (nee: logcatd)
|
|
|
|
userdebug_or_eng(`
|
|
|
|
unix_socket_connect(logd, logdr, logd)
|
|
|
|
')
|
|
|
|
|
2013-11-13 00:34:52 +01:00
|
|
|
###
|
|
|
|
### Neverallow rules
|
|
|
|
###
|
|
|
|
### logd should NEVER do any of this
|
|
|
|
|
|
|
|
# Block device access.
|
|
|
|
neverallow logd dev_type:blk_file { read write };
|
|
|
|
|
|
|
|
# ptrace any other app
|
|
|
|
neverallow logd domain:process ptrace;
|
|
|
|
|
|
|
|
# Write to /system.
|
|
|
|
neverallow logd system_file:dir_file_class_set write;
|
|
|
|
|
|
|
|
# Write to files in /data/data or system files on /data
|
|
|
|
neverallow logd { app_data_file system_data_file }:dir_file_class_set write;
|
2015-09-22 01:22:21 +02:00
|
|
|
|
|
|
|
# logd is not allowed to write anywhere other than /misc/data/logd, and then
|
|
|
|
# only on userdebug or eng builds
|
|
|
|
neverallow logd { file_type -logd_tmpfs userdebug_or_eng(` -misc_logd_file -coredump_file ') }:file write;
|