DivestOS/Patches/LineageOS-21.0/android_bionic/0001-HM-Runtime_Control-3.patch
Tavi d98f33a337 21.0: Initial bringup
TODO:
- f/w/b
- settings

Signed-off-by: Tavi <tavi@divested.dev>
2024-05-20 11:53:38 -04:00

27 lines
1.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
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 :