diff --git a/file.te b/file.te index 28076f57c4905e4640cf79fd6cec92c3be7c614f..0e08a38b5fd350185721cc0f7d2996ef1900d292 100644 --- a/file.te +++ b/file.te @@ -165,6 +165,7 @@ type logdr_socket, file_type, mlstrustedobject; type logdw_socket, file_type, mlstrustedobject; type mdns_socket, file_type; type mdnsd_socket, file_type, mlstrustedobject; +type misc_logd_file, file_type; type mtpd_socket, file_type; type netd_socket, file_type; type property_socket, file_type; diff --git a/file_contexts b/file_contexts index cc152f661231e632840e14a5f4dfd866448477b4..5ca2852dec94e6eb296ccaf29ddaeb1329ec4301 100644 --- a/file_contexts +++ b/file_contexts @@ -236,6 +236,7 @@ /data/misc/gatekeeper(/.*)? u:object_r:gatekeeper_data_file:s0 /data/misc/keychain(/.*)? u:object_r:keychain_data_file:s0 /data/misc/keystore(/.*)? u:object_r:keystore_data_file:s0 +/data/misc/logd(/.*)? u:object_r:misc_logd_file:s0 /data/misc/media(/.*)? u:object_r:media_data_file:s0 /data/misc/net(/.*)? u:object_r:net_data_file:s0 /data/misc/shared_relro(/.*)? u:object_r:shared_relro_file:s0 diff --git a/init.te b/init.te index 3af01fbee55f5bfe14a61abae3231d6c20f4531d..34b010cf3ce1dd9cad4a50f3cae6c1c2ce1fac52 100644 --- a/init.te +++ b/init.te @@ -161,6 +161,10 @@ recovery_only(` domain_trans(init, shell_exec, shell) domain_trans(init, init_exec, ueventd) domain_trans(init, init_exec, watchdogd) +# case where logpersistd is actually logcat -f in logd context (nee: logcatd) +userdebug_or_eng(` + domain_auto_trans(init, logcat_exec, logd) +') # Support "adb shell stop" allow init self:capability kill; diff --git a/logd.te b/logd.te index 8c28b48a1e13aa2030ae5c2a96d4699e1be1f6e4..b0d978f3d0b18a20a45f84e8fbde6dc493c57bc3 100644 --- a/logd.te +++ b/logd.te @@ -10,6 +10,10 @@ allow logd self:netlink_audit_socket { create_socket_perms nlmsg_write }; allow logd kernel:system syslog_read; allow logd kmsg_device:chr_file w_file_perms; allow logd system_data_file:file r_file_perms; +allow logd misc_logd_file:file create_file_perms; +allow logd misc_logd_file:dir rw_dir_perms; +allow logd pstorefs:dir search; +allow logd pstorefs:file r_file_perms; r_dir_file(logd, domain) @@ -17,6 +21,11 @@ allow logd kernel:system syslog_mod; control_logd(logd) +# case where logpersistd is actually logcat -f in logd context (nee: logcatd) +userdebug_or_eng(` + unix_socket_connect(logd, logdr, logd) +') + ### ### Neverallow rules ### diff --git a/shell.te b/shell.te index c55ce3e88f211cda601e38bfa2ca3a7e1e1ef6fb..ac553462a9374f4de8bb2dd043899aae09e1c6e9 100644 --- a/shell.te +++ b/shell.te @@ -15,6 +15,9 @@ control_logd(shell) # logcat -L (directly, or via dumpstate) allow shell pstorefs:dir search; allow shell pstorefs:file r_file_perms; +# logpersistd (nee logcatd) files +allow shell misc_logd_file:dir r_dir_perms; +allow shell misc_logd_file:file r_file_perms; # read files in /data/anr allow shell anr_data_file:dir r_dir_perms;