[compiler-rt] [scudo] Remove malloc_enable_child from API. (PR #215439)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 17:54:38 PDT 2026


https://github.com/cferris1000 created https://github.com/llvm/llvm-project/pull/215439

The malloc_enable_child does not need to be a public API, instead move the function to be static and reference it that way.

>From 30c76726b57d3c4292bdad7d236354e3eab72c34 Mon Sep 17 00:00:00 2001
From: Christopher Ferris <cferris at google.com>
Date: Mon, 10 Aug 2026 17:51:19 -0700
Subject: [PATCH] [scudo] Remove malloc_enable_child from API.

The malloc_enable_child does not need to be a public API, instead move
the function to be static and reference it that way.
---
 compiler-rt/lib/scudo/standalone/wrappers_c.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
index 4398420926d6c..26df01895cb8b 100644
--- a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
+++ b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
@@ -73,6 +73,8 @@ static void reportReallocDeallocation(void *old_ptr) {
   }
 }
 
+static void enableInChildAfterFork() { Allocator.enable(/*IsChild*/ true); }
+
 extern "C" {
 
 INTERFACE WEAK void *SCUDO_PREFIX(calloc)(size_t nmemb, size_t size) {
@@ -287,15 +289,12 @@ INTERFACE WEAK int SCUDO_PREFIX(malloc_iterate)(
 INTERFACE WEAK void SCUDO_PREFIX(malloc_enable)() {
   Allocator.enable(/*IsChild*/ false);
 }
-INTERFACE WEAK void SCUDO_PREFIX(malloc_enable_child)() {
-  Allocator.enable(/*IsChild*/ true);
-}
 INTERFACE WEAK void SCUDO_PREFIX(malloc_disable)() { Allocator.disable(); }
 
 void SCUDO_PREFIX(malloc_postinit)() {
   Allocator.initGwpAsan();
   pthread_atfork(SCUDO_PREFIX(malloc_disable), SCUDO_PREFIX(malloc_enable),
-                 SCUDO_PREFIX(malloc_enable_child));
+                 enableInChildAfterFork);
 }
 
 INTERFACE WEAK int SCUDO_PREFIX(mallopt)(int param, int value) {



More information about the llvm-commits mailing list