From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Tue, 2 May 2023 16:46:56 +0300 Subject: [PATCH] support disabling hardened_malloc for specific program IDs --- libc/bionic/malloc_common.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp index 86e6fdcf9..3d3e8ef61 100644 --- a/libc/bionic/malloc_common.cpp +++ b/libc/bionic/malloc_common.cpp @@ -423,7 +423,11 @@ static constexpr MallocDispatch __scudo_malloc_dispatch __attribute__((unused)) static const MallocDispatch* native_allocator_dispatch; void InitNativeAllocatorDispatch(libc_globals* globals) { - const bool hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr; + bool hardened_impl = true; + switch (get_prog_id()) { + default: + hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr; + } const MallocDispatch* table = hardened_impl ? &__libc_malloc_default_dispatch :