[compiler-rt] scudo: default enabled dealloc_type_mismatch on new platforms (PR #146739)

Justin King via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 09:12:36 PDT 2025


https://github.com/jcking created https://github.com/llvm/llvm-project/pull/146739

@vitalybuka 

>From a643450c50b66fb858c6e42a7956cc6367aada67 Mon Sep 17 00:00:00 2001
From: Justin King <jcking at google.com>
Date: Wed, 2 Jul 2025 09:11:50 -0700
Subject: [PATCH] scudo: default enabled dealloc_type_mismatch on new platforms

Signed-off-by: Justin King <jcking at google.com>
---
 compiler-rt/lib/scudo/standalone/flags.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/scudo/standalone/flags.inc b/compiler-rt/lib/scudo/standalone/flags.inc
index ff0c28e1db7c4..570c1defb23ea 100644
--- a/compiler-rt/lib/scudo/standalone/flags.inc
+++ b/compiler-rt/lib/scudo/standalone/flags.inc
@@ -24,7 +24,11 @@ SCUDO_FLAG(int, quarantine_max_chunk_size, 0,
            "Size (in bytes) up to which chunks will be quarantined (if lower "
            "than or equal to).")
 
-SCUDO_FLAG(bool, dealloc_type_mismatch, false,
+// Historically dealloc_type_mismatch was disabled by default. Mismatching is
+// undefined behavior and software that triggers it should feel bad. To stop the
+// bleeding, we default enable except on Android, Fuchsia, and Trusty.
+SCUDO_FLAG(bool, dealloc_type_mismatch,
+           !SCUDO_ANDROID && !SCUDO_FUCHSIA && !SCUDO_TRUSTY,
            "Terminate on a type mismatch in allocation-deallocation functions, "
            "eg: malloc/delete, new/free, new/delete[], etc.")
 



More information about the llvm-commits mailing list