logd: security buffer only AID_SYSTEM reader
Bug: 26029733
Change-Id: I140e5eb8bb39271fa674744651127e3fc545cbe8
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index 846dd7c..cc6df80 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -36,6 +36,18 @@
reader(reader) {
}
+static bool clientHasSecurityCredentials(uid_t uid, gid_t gid, pid_t /* pid */) {
+ if (uid == AID_SYSTEM) {
+ return true;
+ }
+
+ if (gid == AID_SYSTEM) {
+ return true;
+ }
+
+ return false;
+}
+
bool LogListener::onDataAvailable(SocketClient *cli) {
static bool name_set;
if (!name_set) {
@@ -98,7 +110,7 @@
if ((header->id == LOG_ID_SECURITY) &&
(!__android_log_security() ||
- !clientHasLogCredentials(cred->uid, cred->gid, cred->pid))) {
+ !clientHasSecurityCredentials(cred->uid, cred->gid, cred->pid))) {
return false;
}