2017-03-23 22:27:32 +01:00
|
|
|
typeattribute logpersist coredomain;
|
|
|
|
|
2016-08-10 20:10:02 +02:00
|
|
|
# android debug log storage in logpersist domains (eng and userdebug only)
|
|
|
|
userdebug_or_eng(`
|
|
|
|
|
|
|
|
r_dir_file(logpersist, cgroup)
|
2021-02-12 00:18:11 +01:00
|
|
|
r_dir_file(logpersist, cgroup_v2)
|
2016-08-10 20:10:02 +02:00
|
|
|
|
|
|
|
allow logpersist misc_logd_file:file create_file_perms;
|
|
|
|
allow logpersist misc_logd_file:dir rw_dir_perms;
|
|
|
|
|
2017-11-09 23:51:26 +01:00
|
|
|
allow logpersist self:global_capability_class_set sys_nice;
|
2016-08-10 20:10:02 +02:00
|
|
|
allow logpersist pstorefs:dir search;
|
|
|
|
allow logpersist pstorefs:file r_file_perms;
|
|
|
|
|
|
|
|
control_logd(logpersist)
|
|
|
|
unix_socket_connect(logpersist, logdr, logd)
|
2021-11-22 06:18:03 +01:00
|
|
|
get_prop(logpersist, logd_prop)
|
2016-11-08 00:11:39 +01:00
|
|
|
read_runtime_log_tags(logpersist)
|
2016-08-10 20:10:02 +02:00
|
|
|
|
|
|
|
')
|
|
|
|
|
2024-03-27 09:18:41 +01:00
|
|
|
# logcatd is a shell script that execs logcat with various parameters.
|
|
|
|
allow logpersist shell_exec:file rx_file_perms;
|
|
|
|
allow logpersist logcat_exec:file rx_file_perms;
|
|
|
|
|
|
|
|
allowxperm logpersist misc_logd_file:file ioctl {
|
|
|
|
F2FS_IOC_RELEASE_COMPRESS_BLOCKS
|
|
|
|
FS_IOC_SETFLAGS
|
|
|
|
};
|
|
|
|
|
|
|
|
###
|
|
|
|
### Neverallow rules
|
|
|
|
###
|
|
|
|
### logpersist should NEVER do any of this
|
|
|
|
|
|
|
|
# Block device access.
|
|
|
|
neverallow logpersist dev_type:blk_file { read write };
|
|
|
|
|
|
|
|
# ptrace any other app
|
|
|
|
neverallow logpersist domain:process ptrace;
|
|
|
|
|
|
|
|
# Write to files in /data/data or system files on /data except misc_logd_file
|
|
|
|
neverallow logpersist { app_data_file_type system_data_file }:dir_file_class_set write;
|
|
|
|
|
|
|
|
# Only init should be allowed to enter the logpersist domain via exec()
|
|
|
|
# Following is a list of debug domains we know that transition to logpersist
|
|
|
|
# neverallow_with_undefined_domains {
|
|
|
|
# domain
|
|
|
|
# -init # goldfish, logcatd, raft
|
|
|
|
# -mmi # bat, mtp8996, msmcobalt
|
|
|
|
# -system_app # Smith.apk
|
|
|
|
# } logpersist:process transition;
|
|
|
|
neverallow * logpersist:process dyntransition;
|
|
|
|
|
2016-08-10 20:10:02 +02:00
|
|
|
# logpersist is allowed to write to /data/misc/log for userdebug and eng builds
|
2019-06-14 00:05:15 +02:00
|
|
|
neverallow logpersist {
|
|
|
|
file_type
|
|
|
|
userdebug_or_eng(`-misc_logd_file -coredump_file')
|
|
|
|
with_native_coverage(`-method_trace_data_file')
|
|
|
|
}:file { create write append };
|
2020-01-18 04:00:16 +01:00
|
|
|
neverallow { domain -init -dumpstate -incidentd userdebug_or_eng(`-logpersist -logd') } misc_logd_file:file no_rw_file_perms;
|
2019-07-08 22:17:03 +02:00
|
|
|
neverallow { domain -init userdebug_or_eng(`-logpersist -logd') } misc_logd_file:file no_w_file_perms;
|
2016-09-13 18:33:35 +02:00
|
|
|
neverallow { domain -init userdebug_or_eng(`-logpersist -logd') } misc_logd_file:dir { add_name link relabelfrom remove_name rename reparent rmdir write };
|