Commit d128f5c0bb

Misaki Kasumi <misakikasumi@outlook.com>
2025-04-02 12:36:40
std.os.linux: block all signals in raise
1 parent 06fc600
Changed files (1)
lib
lib/std/posix.zig
@@ -722,9 +722,12 @@ pub fn raise(sig: u8) RaiseError!void {
     }
 
     if (native_os == .linux) {
+        // https://git.musl-libc.org/cgit/musl/commit/?id=0bed7e0acfd34e3fb63ca0e4d99b7592571355a9
+        //
+        // Unlike musl, libc-less Zig std does not have any internal signals for implementation purposes, so we
+        // need to block all signals on the assumption that any of them could potentially fork() in a handler.
         var set: sigset_t = undefined;
-        // block application signals
-        sigprocmask(SIG.BLOCK, &linux.app_mask, &set);
+        sigprocmask(SIG.BLOCK, &linux.all_mask, &set);
 
         const tid = linux.gettid();
         const rc = linux.tkill(tid, sig);