Loading debuggerd/debuggerd_test.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,14 @@ constexpr char kWaitForDebuggerKey[] = "debug.debuggerd.wait_for_debugger"; // Enable GWP-ASan at the start of this process. GWP-ASan is enabled using // process sampling, so we need to ensure we force GWP-ASan on. __attribute__((constructor)) static void enable_gwp_asan() { bool force = true; android_mallopt(M_INITIALIZE_GWP_ASAN, &force, sizeof(force)); android_mallopt_gwp_asan_options_t opts; // No, we're not an app, but let's turn ourselves on without sampling. // Technically, if someone's using the *.default_app sysprops, they'll adjust // our settings, but I don't think this will be common on a device that's // running debuggerd_tests. opts.desire = android_mallopt_gwp_asan_options_t::Action::TURN_ON_FOR_APP; opts.program_name = ""; android_mallopt(M_INITIALIZE_GWP_ASAN, &opts, sizeof(android_mallopt_gwp_asan_options_t)); } static void tombstoned_intercept(pid_t target_pid, unique_fd* intercept_fd, unique_fd* output_fd, Loading debuggerd/libdebuggerd/gwp_asan.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -43,10 +43,13 @@ static bool retrieve_gwp_asan_state(unwindstack::Memory* process_memory, uintptr static const gwp_asan::AllocationMetadata* retrieve_gwp_asan_metadata( unwindstack::Memory* process_memory, const gwp_asan::AllocatorState& state, uintptr_t metadata_addr) { if (state.MaxSimultaneousAllocations > 1024) { // 1 million GWP-ASan slots would take 4.1GiB of space. Thankfully, copying // the metadata for that amount of slots is only 532MiB, and this really will // only be used with some ridiculous torture-tests. if (state.MaxSimultaneousAllocations > 1000000) { ALOGE( "Error when retrieving GWP-ASan metadata, MSA from state (%zu) " "exceeds maximum allowed (1024).", "exceeds maximum allowed (1,000,000).", state.MaxSimultaneousAllocations); return nullptr; } Loading Loading
debuggerd/debuggerd_test.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,14 @@ constexpr char kWaitForDebuggerKey[] = "debug.debuggerd.wait_for_debugger"; // Enable GWP-ASan at the start of this process. GWP-ASan is enabled using // process sampling, so we need to ensure we force GWP-ASan on. __attribute__((constructor)) static void enable_gwp_asan() { bool force = true; android_mallopt(M_INITIALIZE_GWP_ASAN, &force, sizeof(force)); android_mallopt_gwp_asan_options_t opts; // No, we're not an app, but let's turn ourselves on without sampling. // Technically, if someone's using the *.default_app sysprops, they'll adjust // our settings, but I don't think this will be common on a device that's // running debuggerd_tests. opts.desire = android_mallopt_gwp_asan_options_t::Action::TURN_ON_FOR_APP; opts.program_name = ""; android_mallopt(M_INITIALIZE_GWP_ASAN, &opts, sizeof(android_mallopt_gwp_asan_options_t)); } static void tombstoned_intercept(pid_t target_pid, unique_fd* intercept_fd, unique_fd* output_fd, Loading
debuggerd/libdebuggerd/gwp_asan.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -43,10 +43,13 @@ static bool retrieve_gwp_asan_state(unwindstack::Memory* process_memory, uintptr static const gwp_asan::AllocationMetadata* retrieve_gwp_asan_metadata( unwindstack::Memory* process_memory, const gwp_asan::AllocatorState& state, uintptr_t metadata_addr) { if (state.MaxSimultaneousAllocations > 1024) { // 1 million GWP-ASan slots would take 4.1GiB of space. Thankfully, copying // the metadata for that amount of slots is only 532MiB, and this really will // only be used with some ridiculous torture-tests. if (state.MaxSimultaneousAllocations > 1000000) { ALOGE( "Error when retrieving GWP-ASan metadata, MSA from state (%zu) " "exceeds maximum allowed (1024).", "exceeds maximum allowed (1,000,000).", state.MaxSimultaneousAllocations); return nullptr; } Loading