Revert "logd: liblog: whitelist "snet_event_log""

Callers will not guarantee that they can or will ratelimit, we need to
retain the ability to blacklist snet_event_log as a result.

This reverts commit 6aa21b225dd1600473388bd640443653d649420a.

Bug: 26178938
Change-Id: Ibf47d2e23a84c56f5f72d02312c698df7ff2b601
diff --git a/liblog/Android.mk b/liblog/Android.mk
index 4ab5006..a183db8 100644
--- a/liblog/Android.mk
+++ b/liblog/Android.mk
@@ -22,7 +22,7 @@
 #       's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
 #       $(LOCAL_PATH)/event.logtags)
 # so make sure we do not regret hard-coding it as follows:
-liblog_cflags := -DLIBLOG_LOG_TAG=1005 -DSNET_EVENT_LOG_TAG=1397638484
+liblog_cflags := -DLIBLOG_LOG_TAG=1005
 
 liblog_host_sources := logd_write.c log_event_write.c fake_log_device.c event.logtags
 liblog_target_sources := logd_write.c log_event_write.c event_tag_map.c log_time.cpp log_is_loggable.c
diff --git a/liblog/logd_write.c b/liblog/logd_write.c
index ec86e6b..5406c50 100644
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -221,48 +221,50 @@
             return -EPERM;
         }
     } else if (log_id == LOG_ID_EVENTS) {
+        static atomic_uintptr_t map;
+        int ret;
+        const char *tag;
+        EventTagMap *m, *f;
+
         if (vec[0].iov_len < 4) {
             return -EINVAL;
         }
-        if (((uint32_t *)vec[0].iov_base)[0] != htole32(SNET_EVENT_LOG_TAG)) {
-            static atomic_uintptr_t map;
-            int ret;
-            const char *tag = NULL;
-            EventTagMap *m, *f = NULL;
 
-            m = (EventTagMap *)atomic_load(&map);
+        tag = NULL;
+        f = NULL;
+        m = (EventTagMap *)atomic_load(&map);
+
+        if (!m) {
+            ret = trylock();
+            m = (EventTagMap *)atomic_load(&map); /* trylock flush cache */
             if (!m) {
-                ret = trylock();
-                m = (EventTagMap *)atomic_load(&map); /* trylock flush cache */
-                if (!m) {
-                    m = android_openEventTagMap(EVENT_TAG_MAP_FILE);
-                    if (ret) { /* trylock failed, local copy, mark for close */
-                        f = m;
-                    } else {
-                        if (!m) { /* One chance to open map file */
-                            m = (EventTagMap *)(uintptr_t)-1LL;
-                        }
-                        atomic_store(&map, (uintptr_t)m);
+                m = android_openEventTagMap(EVENT_TAG_MAP_FILE);
+                if (ret) { /* trylock failed, use local copy, mark for close */
+                    f = m;
+                } else {
+                    if (!m) { /* One chance to open map file */
+                        m = (EventTagMap *)(uintptr_t)-1LL;
                     }
-                }
-                if (!ret) { /* trylock succeeded, unlock */
-                    unlock();
+                    atomic_store(&map, (uintptr_t)m);
                 }
             }
-            if (m && (m != (EventTagMap *)(uintptr_t)-1LL)) {
-                tag = android_lookupEventTag(
+            if (!ret) { /* trylock succeeded, unlock */
+                unlock();
+            }
+        }
+        if (m && (m != (EventTagMap *)(uintptr_t)-1LL)) {
+            tag = android_lookupEventTag(
                                     m,
                                     htole32(((uint32_t *)vec[0].iov_base)[0]));
-            }
-            ret = __android_log_is_loggable(ANDROID_LOG_INFO,
-                                            tag,
-                                            ANDROID_LOG_VERBOSE);
-            if (f) { /* local copy marked for close */
-                android_closeEventTagMap(f);
-            }
-            if (!ret) {
-                return -EPERM;
-            }
+        }
+        ret = __android_log_is_loggable(ANDROID_LOG_INFO,
+                                        tag,
+                                        ANDROID_LOG_VERBOSE);
+        if (f) { /* local copy marked for close */
+            android_closeEventTagMap(f);
+        }
+        if (!ret) {
+            return -EPERM;
         }
     } else {
         /* Validate the incoming tag, tag content can not split across iovec */
diff --git a/logd/Android.mk b/logd/Android.mk
index d19c255..feca8d5 100644
--- a/logd/Android.mk
+++ b/logd/Android.mk
@@ -38,9 +38,7 @@
 #  event_flag := $(call event_logtags,auditd)
 #  event_flag += $(call event_logtags,logd)
 # so make sure we do not regret hard-coding it as follows:
-event_flag := -DAUDITD_LOG_TAG=1003 \
-              -DLOGD_LOG_TAG=1004 \
-              -DSNET_EVENT_LOG_TAG=1397638484
+event_flag := -DAUDITD_LOG_TAG=1003 -DLOGD_LOG_TAG=1004
 
 LOCAL_CFLAGS := -Werror $(event_flag)
 
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index 1b829c6..ec32393 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -205,20 +205,16 @@
 
     LogBufferElement *elem = new LogBufferElement(log_id, realtime,
                                                   uid, pid, tid, msg, len);
-    if (log_id != LOG_ID_SECURITY) { // whitelist LOG_ID_SECURITY
+    if (log_id != LOG_ID_SECURITY) {
         int prio = ANDROID_LOG_INFO;
-        const char *tag = (const char *)-1;
+        const char *tag = NULL;
         if (log_id == LOG_ID_EVENTS) {
-            // whitelist "snet_event_log"
-            if (elem->getTag() != SNET_EVENT_LOG_TAG) {
-                tag = android::tagToName(elem->getTag());
-            }
+            tag = android::tagToName(elem->getTag());
         } else {
             prio = *msg;
             tag = msg + 1;
         }
-        if ((tag != (const char *)-1) &&
-                !__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
+        if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
             // Log traffic received to total
             pthread_mutex_lock(&mLogElementsLock);
             stats.add(elem);