| author | |
| committer | |
| log | 9dfdf3503242428f93c56c8f211834bd6b87ac76 |
| tree | e114b0d6a212a773e67bc7f0a308a0c4f0fbcf8a |
| parent | 4303b43519fe8a3b21a264642076d30c2f0927bc |
| parent | aa832d6a6dbde8a0753d6aa59cc8199b009ea260 |
| signature |
* std.os.linux: remove app_mask
* std.posix: on libc-less linux, block all signals in raise(), not just app_mask2 files changed, 5 insertions(+), 3 deletions(-)
lib/std/os/linux.zig-1| ... | @@ -5151,7 +5151,6 @@ pub const NSIG = if (is_mips) 128 else 65; | ... | @@ -5151,7 +5151,6 @@ pub const NSIG = if (is_mips) 128 else 65; |
| 5151 | pub const sigset_t = [1024 / 32]u32; | 5151 | pub const sigset_t = [1024 / 32]u32; |
| 5152 | 5152 | ||
| 5153 | pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.len; | 5153 | pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.len; |
| 5154 | pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30; | ||
| 5155 | 5154 | ||
| 5156 | const k_sigaction_funcs = struct { | 5155 | const k_sigaction_funcs = struct { |
| 5157 | const handler = ?*align(1) const fn (i32) callconv(.c) void; | 5156 | const handler = ?*align(1) const fn (i32) callconv(.c) void; |
lib/std/posix.zig+5-2| ... | @@ -724,9 +724,12 @@ pub fn raise(sig: u8) RaiseError!void { | ... | @@ -724,9 +724,12 @@ pub fn raise(sig: u8) RaiseError!void { |
| 724 | } | 724 | } |
| 725 | 725 | ||
| 726 | if (native_os == .linux) { | 726 | if (native_os == .linux) { |
| 727 | // https://git.musl-libc.org/cgit/musl/commit/?id=0bed7e0acfd34e3fb63ca0e4d99b7592571355a9 | ||
| 728 | // | ||
| 729 | // Unlike musl, libc-less Zig std does not have any internal signals for implementation purposes, so we | ||
| 730 | // need to block all signals on the assumption that any of them could potentially fork() in a handler. | ||
| 727 | var set: sigset_t = undefined; | 731 | var set: sigset_t = undefined; |
| 728 | // block application signals | 732 | sigprocmask(SIG.BLOCK, &linux.all_mask, &set); |
| 729 | sigprocmask(SIG.BLOCK, &linux.app_mask, &set); | ||
| 730 | 733 | ||
| 731 | const tid = linux.gettid(); | 734 | const tid = linux.gettid(); |
| 732 | const rc = linux.tkill(tid, sig); | 735 | const rc = linux.tkill(tid, sig); |