Skip to content

Conversation

thurstond
Copy link
Contributor

This ports #142821 from TSan.

Although MSan doesn't segfault the way TSan did, the failure message was nonetheless cryptic. The improved error message will prepare MSan for the upcoming AppArmorpocalypse.

This ports llvm#142821 from TSan.

Although MSan doesn't segfault the way TSan did, the failure message was
nonetheless cryptic. The improved diagnostics will prepare MSan for the
upcoming AppArmorpocalypse.
@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2025

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

Author: Thurston Dang (thurstond)

Changes

This ports #142821 from TSan.

Although MSan doesn't segfault the way TSan did, the failure message was nonetheless cryptic. The improved error message will prepare MSan for the upcoming AppArmorpocalypse.


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

1 Files Affected:

  • (modified) compiler-rt/lib/msan/msan_linux.cpp (+9-1)
diff --git a/compiler-rt/lib/msan/msan_linux.cpp b/compiler-rt/lib/msan/msan_linux.cpp
index 7140de7e9c543..f08a7c98a4847 100644
--- a/compiler-rt/lib/msan/msan_linux.cpp
+++ b/compiler-rt/lib/msan/msan_linux.cpp
@@ -190,7 +190,15 @@ bool InitShadowWithReExec(bool init_origins) {
               "possibly due to high-entropy ASLR.\n"
               "Re-execing with fixed virtual address space.\n"
               "N.B. reducing ASLR entropy is preferable.\n");
-      CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
+
+      if (personality(old_personality | ADDR_NO_RANDOMIZE) == -1) {
+        Printf(
+            "FATAL: MemorySanitizer: unable to disable ASLR (perhaps "
+            "sandboxing is enabled?).\n");
+        Printf("FATAL: Please rerun without sandboxing and/or ASLR.\n");
+        Die();
+      }
+
       ReExec();
     }
 #  endif

@thurstond thurstond merged commit 7d35226 into llvm:main Sep 25, 2025
13 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
This ports llvm#142821 from TSan.

Although MSan doesn't segfault the way TSan did, the failure message was
nonetheless cryptic. The improved error message will prepare MSan for
the upcoming AppArmorpocalypse.
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