From 7f209a979c55a58e91946a2efd5f0b339ffe309c Mon Sep 17 00:00:00 2001 From: Iris Chang Date: Wed, 16 Jan 2019 11:17:15 +0800 Subject: Bionic malloc debug: add a new option "abort_on_error" This new option causes an abort after malloc debug detects an error. This allows vendors to get process coredumps to analyze memory for corruption. Bug: 123009873 Test: New test cases added for unit tests and config tests. Change-Id: I6b480af7f747d6a82f61e8bf3df204a5f7ba017f --- libc/malloc_debug/GuardData.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libc/malloc_debug/GuardData.cpp') diff --git a/libc/malloc_debug/GuardData.cpp b/libc/malloc_debug/GuardData.cpp index debc14e0c..c307dc996 100644 --- a/libc/malloc_debug/GuardData.cpp +++ b/libc/malloc_debug/GuardData.cpp @@ -64,6 +64,9 @@ void GuardData::LogFailure(const Header* header, const void* pointer, const void error_log("Backtrace at time of failure:"); BacktraceAndLog(); error_log(LOG_DIVIDER); + if (g_debug->config().options() & ABORT_ON_ERROR) { + abort(); + } } FrontGuardData::FrontGuardData(DebugData* debug_data, const Config& config, size_t* offset) -- cgit v1.2.3