[llvm] [clang] Avoid sandbox violation in Windows signal handler (PR #190615)
Jan Svoboda via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 12:21:23 PDT 2026
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/190615
>From be51efec86c1db29a390bbf8bcad6b0a2f63d7ba Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Mon, 6 Apr 2026 08:13:11 -0700
Subject: [PATCH] [clang] Avoid sandbox violation in Windows signal handler
---
llvm/lib/Support/Windows/Signals.inc | 7 +++++++
1 file changed, 7 insertions(+)
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