diff options
author | Nick Kralevich <nnk@google.com> | 2014-07-23 13:56:23 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2014-07-23 15:48:49 -0700 |
commit | be0e43b77676338fd5e6a82c9cc2b6302d579de2 (patch) | |
tree | 4d6418a29796bb609f25cadfd313af9bd94bde0f /linker/debugger.cpp | |
parent | f9bfc2ff8eb5db99a106a8a384498165361291ce (diff) | |
download | android_bionic-be0e43b77676338fd5e6a82c9cc2b6302d579de2.tar.gz android_bionic-be0e43b77676338fd5e6a82c9cc2b6302d579de2.tar.bz2 android_bionic-be0e43b77676338fd5e6a82c9cc2b6302d579de2.zip |
debuggerd: if PR_GET_DUMPABLE=0, don't ask for dumping
PR_GET_DUMPABLE is used by an application to indicate whether or
not core dumps / PTRACE_ATTACH should work.
Security sensitive applications often set PR_SET_DUMPABLE to 0 to
disable core dumps, to avoid leaking sensitive memory to persistent
storage. Similarly, they also set PR_SET_DUMPABLE to zero to prevent
PTRACE_ATTACH from working, again to avoid leaking the contents
of sensitive memory.
Honor PR_GET_DUMPABLE when connecting to debuggerd. If an application
has said it doesn't want its memory dumped, then we shouldn't
ask debuggerd to dump memory on its behalf.
FORTIFY_SOURCE tests: Modify the fortify_source tests to set
PR_SET_DUMPABLE=0. This reduces the total runtime of
/data/nativetest/bionic-unit-tests/bionic-unit-tests32 from approx
53 seconds to 25 seconds. There's no need to connect to debuggerd
when running these tests.
Bug: 16513137
Change-Id: Idc7857b089f3545758f4d9b436b783d580fb653f
Diffstat (limited to 'linker/debugger.cpp')
-rw-r--r-- | linker/debugger.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/linker/debugger.cpp b/linker/debugger.cpp index 9ebb09ba6..079682cab 100644 --- a/linker/debugger.cpp +++ b/linker/debugger.cpp @@ -206,6 +206,15 @@ static bool have_siginfo(int signum) { } static void send_debuggerd_packet(siginfo_t* info) { + if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) { + // process has disabled core dumps and PTRACE_ATTACH, and does not want to be dumped. + // Honor that intention by not connecting to debuggerd and asking it + // to dump our internal state. + __libc_format_log(ANDROID_LOG_INFO, "libc", + "Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0"); + return; + } + int s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM); if (s == -1) { __libc_format_log(ANDROID_LOG_FATAL, "libc", "Unable to open connection to debuggerd: %s", |