restorecon tombstone directory.
Restore the security contexts of tombstone directory
when initially created.
Change-Id: I25b53730991576eccb62ca57050decd584acc639
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
diff --git a/debuggerd/tombstone.c b/debuggerd/tombstone.c
index 16b4943..27ab3fe 100644
--- a/debuggerd/tombstone.c
+++ b/debuggerd/tombstone.c
@@ -35,6 +35,10 @@
#include <corkscrew/demangle.h>
#include <corkscrew/backtrace.h>
+#ifdef HAVE_SELINUX
+#include <selinux/android.h>
+#endif
+
#include "machine.h"
#include "tombstone.h"
#include "utility.h"
@@ -680,6 +684,13 @@
mkdir(TOMBSTONE_DIR, 0755);
chown(TOMBSTONE_DIR, AID_SYSTEM, AID_SYSTEM);
+#ifdef HAVE_SELINUX
+ if (selinux_android_restorecon(TOMBSTONE_DIR) == -1) {
+ *detach_failed = false;
+ return NULL;
+ }
+#endif
+
int fd;
char* path = find_and_open_tombstone(&fd);
if (!path) {