diff options
author | Peter Collingbourne <pcc@google.com> | 2021-01-06 21:02:19 -0800 |
---|---|---|
committer | Peter Collingbourne <pcc@google.com> | 2021-02-12 12:30:52 -0800 |
commit | 2753fc8ee5668b05a94dc3bc029ab9c67bc1af5a (patch) | |
tree | 32fff96bab2a62f23540a1b63334fa8496191ff6 | |
parent | 15ade069b10f7f5291e48c01db2da4852dae04b7 (diff) |
Teach debuggerd to pass the secondary ring buffer to __scudo_get_error_info().
With this change we can report memory errors involving secondary
allocations. Update the existing crasher tests to also test
UAF/overflow/underflow on allocations with sizes sufficient to trigger
the secondary allocator.
Bug: 135772972
Change-Id: Ic8925c1f18621a8f272e26d5630e5d11d6d34d38
-rw-r--r-- | libc/bionic/malloc_common_dynamic.cpp | 2 | ||||
-rw-r--r-- | libc/private/bionic_globals.h | 1 | ||||
-rw-r--r-- | linker/linker_debuggerd_android.cpp | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp index 3a6958cde..31d1e69eb 100644 --- a/libc/bionic/malloc_common_dynamic.cpp +++ b/libc/bionic/malloc_common_dynamic.cpp @@ -370,6 +370,7 @@ static bool InstallHooks(libc_globals* globals, const char* options, const char* extern "C" const char* __scudo_get_stack_depot_addr(); extern "C" const char* __scudo_get_region_info_addr(); +extern "C" const char* __scudo_get_ring_buffer_addr(); // Initializes memory allocation framework once per process. static void MallocInitImpl(libc_globals* globals) { @@ -381,6 +382,7 @@ static void MallocInitImpl(libc_globals* globals) { #if defined(USE_SCUDO) __libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr(); __libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr(); + __libc_shared_globals()->scudo_ring_buffer = __scudo_get_ring_buffer_addr(); #endif // Prefer malloc debug since it existed first and is a more complete diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h index 813226172..57ed03915 100644 --- a/libc/private/bionic_globals.h +++ b/libc/private/bionic_globals.h @@ -108,6 +108,7 @@ struct libc_shared_globals { const char* scudo_stack_depot = nullptr; const char* scudo_region_info = nullptr; + const char* scudo_ring_buffer = nullptr; HeapTaggingLevel initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE; }; diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp index 203e44159..cba6345c1 100644 --- a/linker/linker_debuggerd_android.cpp +++ b/linker/linker_debuggerd_android.cpp @@ -42,6 +42,7 @@ static debugger_process_info get_process_info() { .gwp_asan_metadata = __libc_shared_globals()->gwp_asan_metadata, .scudo_stack_depot = __libc_shared_globals()->scudo_stack_depot, .scudo_region_info = __libc_shared_globals()->scudo_region_info, + .scudo_ring_buffer = __libc_shared_globals()->scudo_ring_buffer, }; } #endif |