diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2014-06-24 13:45:43 -0400 |
---|---|---|
committer | Stephen Smalley <sds@tycho.nsa.gov> | 2014-06-24 14:11:59 -0400 |
commit | 439224e27530353351c7df504fb29fad9ac776a0 (patch) | |
tree | bf9281672a41f297f2a68e7c60fb6334c0b7914d /init | |
parent | 7950fc47a76cf7fe2d5c5e1a25002cb7848cf155 (diff) | |
download | system_core-439224e27530353351c7df504fb29fad9ac776a0.zip system_core-439224e27530353351c7df504fb29fad9ac776a0.tar.gz system_core-439224e27530353351c7df504fb29fad9ac776a0.tar.bz2 |
Redirect libselinux logging to dmesg for ueventd.
We already do this for init, but had failed to do it for ueventd
and could not capture any logging from libselinux calls made by
ueventd.
Truly enabling non-error logging also requires uncommenting a line
in Android.mk:
LOCAL_CFLAGS += -DLOG_UEVENTS=1
which enables other logging and sets the default log level to INFO,
or otherwise changing the klog level in the ueventd code (is not
settable by init.rc loglevel).
Change-Id: I00e6f9d6271f2a21d9078c96368816d74d6d2850
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'init')
-rw-r--r-- | init/init.c | 2 | ||||
-rw-r--r-- | init/log.h | 2 | ||||
-rw-r--r-- | init/ueventd.c | 5 |
3 files changed, 8 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c index 97c33e4..f001071 100644 --- a/init/init.c +++ b/init/init.c @@ -938,7 +938,7 @@ static int audit_callback(void *data, security_class_t cls __attribute__((unused return 0; } -static int log_callback(int type, const char *fmt, ...) +int log_callback(int type, const char *fmt, ...) { int level; va_list ap; @@ -23,4 +23,6 @@ #define NOTICE(x...) KLOG_NOTICE("init", x) #define INFO(x...) KLOG_INFO("init", x) +extern int log_callback(int type, const char *fmt, ...); + #endif diff --git a/init/ueventd.c b/init/ueventd.c index 4ad0cb9..833e4fd 100644 --- a/init/ueventd.c +++ b/init/ueventd.c @@ -21,6 +21,7 @@ #include <stdio.h> #include <ctype.h> #include <signal.h> +#include <selinux/selinux.h> #include <private/android_filesystem_config.h> @@ -76,6 +77,10 @@ int ueventd_main(int argc, char **argv) } #endif + union selinux_callback cb; + cb.func_log = log_callback; + selinux_set_callback(SELINUX_CB_LOG, cb); + INFO("starting ueventd\n"); /* Respect hardware passed in through the kernel cmd line. Here we will look |