commit d128f5c0bb06b9485f37145e24bc99cbba27087c (tree)
parent 06fc600aec227f00d1edbb0b1577b26e490c7d8c
Author: Misaki Kasumi <misakikasumi@outlook.com>
Date: Wed, 2 Apr 2025 18:36:40 +0800
std.os.linux: block all signals in raise
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/std/posix.zig b/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);