Skip to content

scudo: default enabled dealloc_type_mismatch on new platforms #146739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcking
Copy link
Contributor

@jcking jcking commented Jul 2, 2025

Default enable on new platforms, leaving it disabled for existing well known platforms using scudo.

@llvmbot
Copy link
Member

llvmbot commented Jul 2, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Justin King (jcking)

Changes

Default enable on new platforms, leaving it disabled for existing well known platforms using scudo.


Full diff: https://github.com/llvm/llvm-project/pull/146739.diff

1 Files Affected:

  • (modified) compiler-rt/lib/scudo/standalone/flags.inc (+5-1)
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.")
 

@jcking jcking force-pushed the scudo_dealloc_type_mismatch_enable branch from a643450 to 613e145 Compare July 2, 2025 16:18
@jcking jcking force-pushed the scudo_dealloc_type_mismatch_enable branch from 613e145 to 1228ef7 Compare July 2, 2025 16:20
@fmayer
Copy link
Contributor

fmayer commented Jul 2, 2025

LGTM, but wait for @cferris1000 to chime in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants