summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2016-01-25 09:32:38 -0600
committerMark Salyzyn2016-01-26 09:20:29 -0600
commit756332e88b98018d82f225c54734be3d76102bfc (patch)
tree4f543bb8d2db2d1776d3377b8054a550814dba31 /logd/LogListener.cpp
parent4606c9576019ac419b7abd83eb3a7dcd1f16df81 (diff)
downloadplatform-system-core-756332e88b98018d82f225c54734be3d76102bfc.tar.gz
platform-system-core-756332e88b98018d82f225c54734be3d76102bfc.tar.xz
platform-system-core-756332e88b98018d82f225c54734be3d76102bfc.zip
logd: security buffer only AID_SYSTEM reader
Bug: 26029733 Change-Id: I140e5eb8bb39271fa674744651127e3fc545cbe8
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