logd: liblog: whitelist "snet_event_log"
Dangerous bridge to cross to whitelist, who is special, who is not?
Rationalized as these events are used to catch exploits on platform.
As it stands no one should be allowed to block any messages in the
security context, not even for development purposes.
Bug: 26178938
Change-Id: Ibdc76bc0fe29ba05be168b623af1c9f41d7edbd2
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index ec32393..1b829c6 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -205,16 +205,20 @@
LogBufferElement *elem = new LogBufferElement(log_id, realtime,
uid, pid, tid, msg, len);
- if (log_id != LOG_ID_SECURITY) {
+ if (log_id != LOG_ID_SECURITY) { // whitelist LOG_ID_SECURITY
int prio = ANDROID_LOG_INFO;
- const char *tag = NULL;
+ const char *tag = (const char *)-1;
if (log_id == LOG_ID_EVENTS) {
- tag = android::tagToName(elem->getTag());
+ // whitelist "snet_event_log"
+ if (elem->getTag() != SNET_EVENT_LOG_TAG) {
+ tag = android::tagToName(elem->getTag());
+ }
} else {
prio = *msg;
tag = msg + 1;
}
- if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
+ if ((tag != (const char *)-1) &&
+ !__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
// Log traffic received to total
pthread_mutex_lock(&mLogElementsLock);
stats.add(elem);