summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'logd/LogListener.cpp')
-rw-r--r--logd/LogListener.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index 846dd7c41..cc6df8051 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -36,6 +36,18 @@ LogListener::LogListener(LogBuffer *buf, LogReader *reader) :
36 reader(reader) { 36 reader(reader) {
37} 37}
38 38
39static bool clientHasSecurityCredentials(uid_t uid, gid_t gid, pid_t /* pid */) {
40 if (uid == AID_SYSTEM) {
41 return true;
42 }
43
44 if (gid == AID_SYSTEM) {
45 return true;
46 }
47
48 return false;
49}
50
39bool LogListener::onDataAvailable(SocketClient *cli) { 51bool LogListener::onDataAvailable(SocketClient *cli) {
40 static bool name_set; 52 static bool name_set;
41 if (!name_set) { 53 if (!name_set) {
@@ -98,7 +110,7 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
98 110
99 if ((header->id == LOG_ID_SECURITY) && 111 if ((header->id == LOG_ID_SECURITY) &&
100 (!__android_log_security() || 112 (!__android_log_security() ||
101 !clientHasLogCredentials(cred->uid, cred->gid, cred->pid))) { 113 !clientHasSecurityCredentials(cred->uid, cred->gid, cred->pid))) {
102 return false; 114 return false;
103 } 115 }
104 116