From bd558d61871218f5b13df2fe4b7cc3b530ee947c Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Tue, 16 Apr 2013 12:16:50 -0400 Subject: [PATCH] Handle policy reloads within installd rather than restarting it. Restarting installd upon policy reloads has reportedly caused stability problems for some users. Stop restarting installd and instead handle policy reloads within it. Change-Id: I697a736d8e414cfc6cfa131ed7b97c7f7694d022 Signed-off-by: Stephen Smalley --- cmds/installd/installd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index c918633f3..83b2b4ecd 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -16,6 +16,8 @@ #include #include +#include +#include #include "installd.h" @@ -525,6 +527,7 @@ int main(const int argc, const char *argv[]) { struct sockaddr addr; socklen_t alen; int lsocket, s, count; + int selinux_enabled = (is_selinux_enabled() > 0); ALOGI("installd firing up\n"); @@ -538,6 +541,11 @@ int main(const int argc, const char *argv[]) { exit(1); } + if (selinux_enabled && selinux_status_open(true) < 0) { + ALOGE("Could not open selinux status; exiting.\n"); + exit(1); + } + drop_privileges(); lsocket = android_get_control_socket(SOCKET_PATH); @@ -576,6 +584,9 @@ int main(const int argc, const char *argv[]) { break; } buf[count] = 0; + if (selinux_enabled && selinux_status_updated() > 0) { + selinux_android_seapp_context_reload(); + } if (execute(s, buf)) break; } ALOGI("closing connection\n");