Loading init/Android.mk +1 −2 Original line number Original line Diff line number Diff line Loading @@ -74,7 +74,7 @@ LOCAL_SRC_FILES:= \ service.cpp \ service.cpp \ util.cpp \ util.cpp \ LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup LOCAL_WHOLE_STATIC_LIBRARIES := libcap LOCAL_WHOLE_STATIC_LIBRARIES := libcap LOCAL_MODULE := libinit LOCAL_MODULE := libinit LOCAL_SANITIZE := integer LOCAL_SANITIZE := integer Loading Loading @@ -124,7 +124,6 @@ LOCAL_STATIC_LIBRARIES := \ libsparse \ libsparse \ libz \ libz \ libprocessgroup \ libprocessgroup \ libnl \ libavb libavb # Create symlinks. # Create symlinks. Loading init/log.cpp +2 −28 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <string.h> #include <string.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <netlink/netlink.h> #include <selinux/selinux.h> #include <selinux/selinux.h> void InitKernelLogging(char* argv[]) { void InitKernelLogging(char* argv[]) { Loading @@ -41,24 +40,6 @@ void InitKernelLogging(char* argv[]) { android::base::InitLogging(argv, &android::base::KernelLogger); 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, ...) { int selinux_klog_callback(int type, const char *fmt, ...) { android::base::LogSeverity severity = android::base::ERROR; android::base::LogSeverity severity = android::base::ERROR; if (type == SELINUX_WARNING) { if (type == SELINUX_WARNING) { Loading @@ -69,15 +50,8 @@ int selinux_klog_callback(int type, const char *fmt, ...) { char buf[1024]; char buf[1024]; va_list ap; va_list ap; va_start(ap, fmt); va_start(ap, fmt); int res = vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(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; return 0; } } Loading
init/Android.mk +1 −2 Original line number Original line Diff line number Diff line Loading @@ -74,7 +74,7 @@ LOCAL_SRC_FILES:= \ service.cpp \ service.cpp \ util.cpp \ util.cpp \ LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup LOCAL_WHOLE_STATIC_LIBRARIES := libcap LOCAL_WHOLE_STATIC_LIBRARIES := libcap LOCAL_MODULE := libinit LOCAL_MODULE := libinit LOCAL_SANITIZE := integer LOCAL_SANITIZE := integer Loading Loading @@ -124,7 +124,6 @@ LOCAL_STATIC_LIBRARIES := \ libsparse \ libsparse \ libz \ libz \ libprocessgroup \ libprocessgroup \ libnl \ libavb libavb # Create symlinks. # Create symlinks. Loading
init/log.cpp +2 −28 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <string.h> #include <string.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <netlink/netlink.h> #include <selinux/selinux.h> #include <selinux/selinux.h> void InitKernelLogging(char* argv[]) { void InitKernelLogging(char* argv[]) { Loading @@ -41,24 +40,6 @@ void InitKernelLogging(char* argv[]) { android::base::InitLogging(argv, &android::base::KernelLogger); 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, ...) { int selinux_klog_callback(int type, const char *fmt, ...) { android::base::LogSeverity severity = android::base::ERROR; android::base::LogSeverity severity = android::base::ERROR; if (type == SELINUX_WARNING) { if (type == SELINUX_WARNING) { Loading @@ -69,15 +50,8 @@ int selinux_klog_callback(int type, const char *fmt, ...) { char buf[1024]; char buf[1024]; va_list ap; va_list ap; va_start(ap, fmt); va_start(ap, fmt); int res = vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(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; return 0; } }