[llvm] a234dfe - [clang] Avoid sandbox violation in Windows signal handler (#190615)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 15:28:59 PDT 2026


Author: Jan Svoboda
Date: 2026-04-07T15:28:54-07:00
New Revision: a234dfedd13e6066a8dd2f8600f0765d7f62f4e7

URL: https://github.com/llvm/llvm-project/commit/a234dfedd13e6066a8dd2f8600f0765d7f62f4e7
DIFF: https://github.com/llvm/llvm-project/commit/a234dfedd13e6066a8dd2f8600f0765d7f62f4e7.diff

LOG: [clang] Avoid sandbox violation in Windows signal handler (#190615)

This bypasses the IO sandbox in some of Windows signal handling, which
previously prevented stack traces from being printed.

Added: 
    

Modified: 
    llvm/lib/Support/Windows/Signals.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Windows/Signals.inc b/llvm/lib/Support/Windows/Signals.inc
index 7e6799befb983..ec55af04c9c24 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -21,6 +21,7 @@
 #include <stdio.h>
 
 #include "llvm/Support/Format.h"
+#include "llvm/Support/IOSandbox.h"
 #include "llvm/Support/raw_ostream.h"
 
 // The Windows.h header must be after LLVM and standard headers.
@@ -798,6 +799,9 @@ void sys::CleanupOnSignal(uintptr_t Context) {
 }
 
 static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
+  // Let's not interfere with stack trace symbolication and friends.
+  auto BypassSandbox = sys::sandbox::scopedDisable();
+
   Cleanup(true);
 
   // Write out the exception code.
@@ -833,6 +837,9 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
 }
 
 static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
+  // Let's not interfere with stack trace symbolication and friends.
+  auto BypassSandbox = sys::sandbox::scopedDisable();
+
   // We are running in our very own thread, courtesy of Windows.
   EnterCriticalSection(&CriticalSection);
   // This function is only ever called when a CTRL-C or similar control signal


        


More information about the llvm-commits mailing list