From f61d4317a325db1e1489bcd257f94ef605db0244 Mon Sep 17 00:00:00 2001 From: anematode Date: Fri, 16 Jan 2026 23:50:40 -0800 Subject: [PATCH] use default signal handler after cleanup With the current setup, on Linux, SIGILL (and SIGSEGV/SIGBUS etc., in the case of a program bug) lead to no feedback if they occur after the signal handlers are installed, they just exit silently. By invoking the default signal handler, we can still get the appropriate feedback. This is particularly important for feedback if someone downloads the wrong SF binary and runs it on Linux. closes https://github.com/official-stockfish/Stockfish/pull/6554 No functional change --- src/shm_linux.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shm_linux.h b/src/shm_linux.h index 6b3182ae0..1b7ac2c77 100644 --- a/src/shm_linux.h +++ b/src/shm_linux.h @@ -106,7 +106,16 @@ class CleanupHooks { // Search threads may still be running, so skip munmap (but still perform // other cleanup actions). The memory mappings will be released on exit. SharedMemoryRegistry::cleanup_all(true); - _Exit(128 + sig); + + // Invoke the default handler, which will exit + struct sigaction sa; + sa.sa_handler = SIG_DFL; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction(sig, &sa, nullptr) == -1) + _Exit(128 + sig); + + raise(sig); } static void register_signal_handlers() noexcept {