20dc3f8fa4b192d902d58f496ae15ff33faa78ac |
|
27-Aug-2014 |
Christopher Ferris <cferris@google.com> |
Replace snprintf calls in linker. When enabling debug malloc, the snprintf calls in the linker fails to update the buffer. The problem is that snprintf makes a call to pthread_getspecific that returns a valid pointer, but the data it points to is zero. This should never happen and causes the snprintf to stop and do nothing. Temporarily replace snprintf with a different implementation to work around this issue. Bug: 16874447 Bug: 17302493 Change-Id: I7a500f28adf153150cf2812fae745ff41f1c48d3
|
172955a4e30b88ce8239a7ef426b4e8903e9923c |
|
27-Aug-2014 |
Christopher Ferris <cferris@google.com> |
Replace snprintf calls in linker. When enabling debug malloc, the snprintf calls in the linker fails to update the buffer. The problem is that snprintf makes a call to pthread_getspecific that returns a valid pointer, but the data it points to is zero. This should never happen and causes the snprintf to stop and do nothing. Temporarily replace snprintf with a different implementation to work around this issue. Bug: 16874447 Bug: 17302493 Change-Id: I7a500f28adf153150cf2812fae745ff41f1c48d3
|
92d8b2320a4c3911452227f560ae4a39e83b0abf |
|
23-Jul-2014 |
Nick Kralevich <nnk@google.com> |
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 (cherry picked from commit be0e43b77676338fd5e6a82c9cc2b6302d579de2) Change-Id: I6e1a9bce564e94fc19893d639b15f38c549cabfa
|
00c855eb3d56a683e7c3c2d08b7be0451f74bb83 |
|
17-May-2014 |
Elliott Hughes <enh@google.com> |
Rethrow SIGTRAP too. Bug: 15024256 Change-Id: I0347da9698a6ccd317ce6e6f7916d710d66e0f8a
|
62e35755eb09caa6cf4892150fb87a6347afef6e |
|
17-May-2014 |
Elliott Hughes <enh@google.com> |
debugger.cpp should know the names of the signals it catches. Change-Id: I37908b07739ad465652f143848c52bc1ef19e421
|
1728b2396591853345507a063ed6075dfd251706 |
|
14-May-2014 |
Elliott Hughes <enh@google.com> |
Switch to g_ for globals. That's what the Google style guide recommends, and we're starting to get a mix. Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
|
b7e289ed028ee73fda4c044e07d3ec6f783a0ef4 |
|
26-Apr-2014 |
Elliott Hughes <enh@google.com> |
Pass si_code through to debuggerd. Because we re-raise various signals, we corrupt the si_code that debuggerd sees when it ptraces our siginfo. One possible solution (shown here) is to pass the original si_code value in the message we send to debuggerd. Change-Id: I76f9aa2c0442e5cab611d132532409e700383907
|
17e6a98b48c4f228adb37c8d37bbf71dd2a1c513 |
|
19-Apr-2014 |
Elliott Hughes <enh@google.com> |
Make libc signal handler output more like debuggerd. This has been annoying me for a while, because it's often quite misleading. Today, for example, I saw: Fatal signal 13 (SIGPIPE) at 0x6573 (code=0), thread 25971 (top) where the apparent address is actually the pid of the signal source (in this case the kernel on behalf of the thread itself). This patch isn't as fancy as strace, but it at least means we never say anything misleading. We could decode the si_code field like strace and debuggerd, but I'm reluctant to do that without some way to share the code between at least bionic and debuggerd. Examples after: Fatal signal 13 (SIGPIPE), code 0 in tid 9157 (top) Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 9142 (crasher64) Fatal signal 6 (SIGABRT), code -6 in tid 9132 (crasher64) (Note that the code still shows as 0 for SIGPIPE in the signal handler itself but as -6 (SI_TKILL) in debuggerd; this is actually correct --- debuggerd is showing the re-raised signal sent at the end of the signal handler that initially showed the correct code 0.) Change-Id: I71cad4ab61f422a4f6687a60ac770371790278e0
|
62e9c76ee89effccfbbff08167dbaa5e52618be3 |
|
01-Feb-2014 |
Elliott Hughes <enh@google.com> |
Clean up debugger.cpp slightly. In particular, don't do weird things with 'int tid'. Change-Id: I0fd9158a452967163508ada8987de9494ad5f9af
|
f858bd1c6eec7eb6bbfc8844e0de096be011e99a |
|
01-Feb-2014 |
Elliott Hughes <enh@google.com> |
LP64 binaries should talk to debuggerd64. Change-Id: I7eb30f9d04f80b6b45d3148757970d3f1117493c
|
e365f9d6543bc6607864ef61257505239dde15d1 |
|
10-Oct-2013 |
Marcus Oakland <marcus.oakland@arm.com> |
AArch64: Linker64 support for AArch64 Addition of support for AArch64 in the linker64 target. Change-Id: I8dfd9711278f6706063e91f626b6007ea7a3dd6e Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
|
4eeb1f12a8b63afc0d0ad4d466b16fbffb21cd5a |
|
26-Oct-2013 |
Elliott Hughes <enh@google.com> |
Clean up linker architecture macros. We don't need our own architecture macros; the standard ones will do. This patch also fixes some __x86_64__ tests to be USE_RELA tests instead, because they're not actually x86_64-specific. I've cleaned up architecture-specific code slightly so where possible all the code corresponding to a particular architecture is together. This patch also fixes a bug in LP64 DT_PLTGOT handling, which should be an error rather than falling through into DT_DEBUG! There was another #ifdef bug where we'd only report unexpected DT_ entries on MIPS. Change-Id: Id1d04e372611f641c1aa278a18e379f28af9eaf5
|
c7e9b2331771e5e87c34a8ee3dc6cc41d35b02fe |
|
17-Oct-2013 |
Elliott Hughes <enh@google.com> |
Fix sigaction(3) for 64-bit. Also clean up <signal.h> and revert the hacks that were necessary for 64-bit in linker/debugger.cpp until now. Change-Id: I3b0554ca8a49ee1c97cda086ce2c1954ebc11892
|
c00f2cb587630d5e954c7f548749f1e3170b3cb1 |
|
05-Oct-2013 |
Elliott Hughes <enh@google.com> |
x86_64 linker. Based on I8dc3e2cb596f75dc58ae82e4dc58f8c177dd3323 by Pavel Chupin <pavel.v.chupin@intel.com>. Change-Id: Icd582d277cbe273477b450f2848343d72c86ec9f
|
c620059479c47a78d57086d73726c9adc2f337ad |
|
01-Oct-2013 |
Elliott Hughes <enh@google.com> |
Remove 32-bit assumptions from the ELF code. Change-Id: I2c1f3d34c33685799aade8866eec44479ff9f963
|
84114c8dd5b17efecf7988f263ce431208d7be5a |
|
17-Jul-2013 |
Elliott Hughes <enh@google.com> |
Improve stack overflow diagnostics (take 2). This reverts commits eb1b07469f2b5a392dc1bfd8adc211aea8c72bc5 and d14dc3b87fbf80553f1cafa453816b7f11366627, and fixes the bug where we were calling mmap (which might cause errno to be set) before __set_tls (which is required to implement errno). Bug: 8557703 Change-Id: I2c36d00240c56e156e1bb430d8c22a73a068b70c
|
d14dc3b87fbf80553f1cafa453816b7f11366627 |
|
17-Jul-2013 |
Guang Zhu <guangzhu@google.com> |
Revert "Improve stack overflow diagnostics." This reverts commit aa754dca90487356cabf07ade0e8d88c2630b784. Change-Id: Ifa76eee31f7f44075eb3a48554315b2693062f44
|
aa754dca90487356cabf07ade0e8d88c2630b784 |
|
16-Jul-2013 |
Elliott Hughes <enh@google.com> |
Improve stack overflow diagnostics. We notify debuggerd of problems by installing signal handlers. That's fine except for when the signal is caused by us running off the end of a thread's stack and into the guard page. Bug: 8557703 Change-Id: I1ef65b4bb3bbca7e9a9743056177094921e60ed3
|
7b4d77e400d321ccc7cdadd1cd225ebb1a69d358 |
|
04-Apr-2013 |
Elliott Hughes <enh@google.com> |
Make abort messages available to debuggerd. This adds __libc_fatal, cleans up the internal logging code a bit more, and switches suitable callers over to __libc_fatal. In addition to logging, __libc_fatal stashes the message somewhere that the debuggerd signal handler can find it before calling abort. In the debuggerd signal handler, we pass this address to debuggerd so that it can come back with ptrace to read the message and present it to the user. Bug: 8531731 (cherry picked from commit 0d787c1fa18c6a1f29ef9840e28a68cf077be1de) Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
|
0d787c1fa18c6a1f29ef9840e28a68cf077be1de |
|
04-Apr-2013 |
Elliott Hughes <enh@google.com> |
Make abort messages available to debuggerd. This adds __libc_fatal, cleans up the internal logging code a bit more, and switches suitable callers over to __libc_fatal. In addition to logging, __libc_fatal stashes the message somewhere that the debuggerd signal handler can find it before calling abort. In the debuggerd signal handler, we pass this address to debuggerd so that it can come back with ptrace to read the message and present it to the user. Bug: 8531731 Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
|
8f2a5a0b40fc82126c691d5c30131d908772aab7 |
|
15-Mar-2013 |
Elliott Hughes <enh@google.com> |
Clean up internal libc logging. We only need one logging API, and I prefer the one that does no allocation and is thus safe to use in any context. Also use O_CLOEXEC when opening the /dev/log files. Move everything logging-related into one header file. Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
|
d4ee82dfa3ba01baa10e3ca48fcb31a27b8a4e81 |
|
01-Mar-2013 |
Brian Carlstrom <bdc@google.com> |
Minor linker cleanup, primarily to use Elf32_Dyn Change-Id: Ifa9408e9859c6f79444715bed4808b7c13fdced5
|
6b8e321e610c0683062c0e8d8deabb64565c7403 |
|
22-Jan-2013 |
Elliott Hughes <enh@google.com> |
Clean up debuggerd-related logging. Bug: 7291287 Change-Id: Ia7aa386e8b75b8058d7d9e707e11b1da7dc62f00
|
1e980b6bc8315d00a07312b25486531247abd98c |
|
18-Jan-2013 |
Elliott Hughes <enh@google.com> |
Fix the duplication in the debugging code. We had two copies of the backtrace code, and two copies of the libcorkscrew /proc/pid/maps code. This patch gets us down to one. We also had hacks so we could log in the malloc debugging code. This patch pulls the non-allocating "printf" code out of the dynamic linker so everyone can share. This patch also makes the leak diagnostics easier to read, and makes it possible to paste them directly into the 'stack' tool (by using relative PCs). This patch also fixes the stdio standard stream leak that was causing a leak warning every time tf_daemon ran. Bug: 7291287 Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8
|
61a9ccb41eba8c35cae6e21318aca7160a402c5b |
|
02-Nov-2012 |
Elliott Hughes <enh@google.com> |
Make dynamic linker debugging always available. If you need to build your own linker to get debugging, the debugging is never available when you need it. Change-Id: I5ff7e55753459d49a2990f25d9aa155e0b8602e0
|
d23736e4f228e46304b7cbc674a1d0094d73e0f5 |
|
01-Nov-2012 |
Elliott Hughes <enh@google.com> |
Keep the dynamic linker's soinfo pools mostly read-only. We'll need a lot more refactoring of this code before we can reduce the granularity, but this is a step forward. Change-Id: I07061720e734b571a8399c1d5b4f2f35cd681307
|
18a206c81d9743481e364384affd43306911283d |
|
30-Oct-2012 |
Elliott Hughes <enh@google.com> |
More dynamic linker cleanup. I still want to break linker_format out into its own library so we can reuse it for malloc debugging and so forth. (There are many similar pieces of code in bionic, but the linker's one seems to be the most complete/functional.) Change-Id: If3721853d28937c8e821ca1d23cf200e228a409a
|