summaryrefslogtreecommitdiffstats
path: root/logd/main.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-03-24 10:26:47 -0700
committerMark Salyzyn <salyzyn@google.com>2014-04-17 16:14:24 +0000
commitdfc47e86858ea67c72f1df2fdb97094b8e8248f2 (patch)
tree749adb2e006a75d4deb2fb769b0dd7b6bc8d2914 /logd/main.cpp
parent26bb9970c463eb1209803d833799f128484864ac (diff)
downloadsystem_core-dfc47e86858ea67c72f1df2fdb97094b8e8248f2.zip
system_core-dfc47e86858ea67c72f1df2fdb97094b8e8248f2.tar.gz
system_core-dfc47e86858ea67c72f1df2fdb97094b8e8248f2.tar.bz2
logd: libsysutils: logd startup outside init environment
Change-Id: I3426b6c3eebdd0c8258e966dcaaaa2825d7a23d1
Diffstat (limited to 'logd/main.cpp')
-rw-r--r--logd/main.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/logd/main.cpp b/logd/main.cpp
index 7346e2f..04eef4a 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -36,6 +36,35 @@
#include "LogListener.h"
#include "LogAudit.h"
+//
+// The service is designed to be run by init, it does not respond well
+// to starting up manually. When starting up manually the sockets will
+// fail to open typically for one of the following reasons:
+// EADDRINUSE if logger is running.
+// EACCESS if started without precautions (below)
+//
+// Here is a cookbook procedure for starting up logd manually assuming
+// init is out of the way, pedantically all permissions and selinux
+// security is put back in place:
+//
+// setenforce 0
+// rm /dev/socket/logd*
+// chmod 777 /dev/socket
+// # here is where you would attach the debugger or valgrind for example
+// runcon u:r:logd:s0 /system/bin/logd </dev/null >/dev/null 2>&1 &
+// sleep 1
+// chmod 755 /dev/socket
+// chown logd.logd /dev/socket/logd*
+// restorecon /dev/socket/logd*
+// setenforce 1
+//
+// If minimalism prevails, typical for debugging and security is not a concern:
+//
+// setenforce 0
+// chmod 777 /dev/socket
+// logd
+//
+
static int drop_privs() {
struct sched_param param;
memset(&param, 0, sizeof(param));