diff options
author | Robert Craig <rpcraig@tycho.ncsc.mil> | 2013-04-04 06:33:10 -0400 |
---|---|---|
committer | Robert Craig <rpcraig@tycho.ncsc.mil> | 2013-04-04 06:33:10 -0400 |
commit | 957983787d7a753d34b582ae0165160f4ebf815c (patch) | |
tree | e7901b07003694b8cf4c477a0f7a335b1a87a07c /cmds | |
parent | 906bd0422a99b37663a1cb130bf061fdbb3ea189 (diff) | |
download | frameworks_native-957983787d7a753d34b582ae0165160f4ebf815c.zip frameworks_native-957983787d7a753d34b582ae0165160f4ebf815c.tar.gz frameworks_native-957983787d7a753d34b582ae0165160f4ebf815c.tar.bz2 |
dumpstate: Add SELinux restorecon call.
Set the security context on the directory used
to dump Dalvik and native stack traces.
Change-Id: Iba13783f10e850485ce1a8d4aa5792d55085eb22
Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/dumpstate/Android.mk | 2 | ||||
-rw-r--r-- | cmds/dumpstate/utils.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk index 18685f7..8640983 100644 --- a/cmds/dumpstate/Android.mk +++ b/cmds/dumpstate/Android.mk @@ -9,7 +9,7 @@ LOCAL_SRC_FILES := dumpstate.c utils.c LOCAL_MODULE := dumpstate -LOCAL_SHARED_LIBRARIES := libcutils +LOCAL_SHARED_LIBRARIES := libcutils libselinux ifdef BOARD_LIB_DUMPSTATE LOCAL_STATIC_LIBRARIES := $(BOARD_LIB_DUMPSTATE) diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c index eaef3d4..5b8ed49 100644 --- a/cmds/dumpstate/utils.c +++ b/cmds/dumpstate/utils.c @@ -38,6 +38,8 @@ #include <cutils/sockets.h> #include <private/android_filesystem_config.h> +#include <selinux/android.h> + #include "dumpstate.h" /* list of native processes to include in the native dumps */ @@ -402,6 +404,9 @@ const char *dump_traces() { if (!mkdir(anr_traces_dir, 0775)) { chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM); chmod(anr_traces_dir, 0775); + if (selinux_android_restorecon(anr_traces_dir) == -1) { + fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno)); + } } else if (errno != EEXIST) { fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno)); return NULL; |