From 347dc623ec18913d78647671c33f48627b494ac3 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Thu, 22 Dec 2022 16:13:09 -0800 Subject: [PATCH] Plumb scudo_ring_buffer_size to debuggerd_process_info This is a no-op but will be used in upcoming scudo changes that allow to change the buffer size at process startup time, and as such we will no longer be able to call __scudo_get_ring_buffer_size in debuggerd. Bug: 263287052 Change-Id: I18f166fc136ac8314d748eb80a806defcc25c9fd --- libc/bionic/malloc_common_dynamic.cpp | 2 ++ libc/private/bionic_globals.h | 1 + linker/linker_debuggerd_android.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp index 97e8d1561..802a94fed 100644 --- a/libc/bionic/malloc_common_dynamic.cpp +++ b/libc/bionic/malloc_common_dynamic.cpp @@ -371,6 +371,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(); +extern "C" size_t __scudo_get_ring_buffer_size(); // Initializes memory allocation framework once per process. static void MallocInitImpl(libc_globals* globals) { @@ -383,6 +384,7 @@ static void MallocInitImpl(libc_globals* globals) { __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(); + __libc_shared_globals()->scudo_ring_buffer_size = __scudo_get_ring_buffer_size(); #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 c7e951d7f..520e50f97 100644 --- a/libc/private/bionic_globals.h +++ b/libc/private/bionic_globals.h @@ -111,6 +111,7 @@ struct libc_shared_globals { const char* scudo_stack_depot = nullptr; const char* scudo_region_info = nullptr; const char* scudo_ring_buffer = nullptr; + size_t scudo_ring_buffer_size = 0; HeapTaggingLevel initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE; bool initial_memtag_stack = false; diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp index cba6345c1..3d6462858 100644 --- a/linker/linker_debuggerd_android.cpp +++ b/linker/linker_debuggerd_android.cpp @@ -43,6 +43,7 @@ static debugger_process_info get_process_info() { .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, + .scudo_ring_buffer_size = __libc_shared_globals()->scudo_ring_buffer_size, }; } #endif