From a39515ce8d2d1a050a5835314597142f6ba92429 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 14 Apr 2017 19:47:05 +0000 Subject: [PATCH] Revert "Send property_service AVC messages to the kernel audit system" This reverts commit 8adb4d9d12d077ee87d1ce97742c6a5ba9aaaf9f. (cherrypick of d8f9356bec6725dfbfb8b02d553c720c91f3f142) Change-Id: I0db29617f323ef31ca5a270d02b7668092e9c9e1 --- init/Android.mk | 3 +-- init/log.cpp | 33 ++++----------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/init/Android.mk b/init/Android.mk index e97f4f2f2..eb27c609e 100644 --- a/init/Android.mk +++ b/init/Android.mk @@ -71,7 +71,7 @@ LOCAL_SRC_FILES:= \ service.cpp \ util.cpp \ -LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl +LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup LOCAL_WHOLE_STATIC_LIBRARIES := libcap LOCAL_MODULE := libinit LOCAL_SANITIZE := integer @@ -122,7 +122,6 @@ LOCAL_STATIC_LIBRARIES := \ libsparse \ libz \ libprocessgroup \ - libnl \ libavb # Create symlinks. diff --git a/init/log.cpp b/init/log.cpp index 6b32526df..06157306b 100644 --- a/init/log.cpp +++ b/init/log.cpp @@ -17,10 +17,10 @@ #include "log.h" #include +#include #include -#include -#include +#include #include void InitKernelLogging(char* argv[]) { @@ -40,24 +40,6 @@ void InitKernelLogging(char* argv[]) { android::base::InitLogging(argv, &android::base::KernelLogger); } -static void selinux_avc_log(char* buf, size_t buf_len) { - size_t str_len = strnlen(buf, buf_len); - - // trim newline at end of string - buf[str_len - 1] = '\0'; - - struct nl_sock* sk = nl_socket_alloc(); - if (sk == NULL) { - return; - } - nl_connect(sk, NETLINK_AUDIT); - int result; - do { - result = nl_send_simple(sk, AUDIT_USER_AVC, 0, buf, str_len); - } while (result == -NLE_INTR); - nl_socket_free(sk); -} - int selinux_klog_callback(int type, const char *fmt, ...) { android::base::LogSeverity severity = android::base::ERROR; if (type == SELINUX_WARNING) { @@ -68,15 +50,8 @@ int selinux_klog_callback(int type, const char *fmt, ...) { char buf[1024]; va_list ap; va_start(ap, fmt); - int res = vsnprintf(buf, sizeof(buf), fmt, ap); + vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); - if (res <= 0) { - return 0; - } - if (type == SELINUX_AVC) { - selinux_avc_log(buf, sizeof(buf)); - } else { - android::base::KernelLogger(android::base::MAIN, severity, "selinux", nullptr, 0, buf); - } + android::base::KernelLogger(android::base::MAIN, severity, "selinux", nullptr, 0, buf); return 0; }