libkernel: sigprocmask and sigsuspend keep SIGKILL and SIGSTOP in the blocked mask #8405

Closed
opened 2026-10-20 12:27:38 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 12:27:38 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T12:27:38Z.


Repro

sigprocmask(SIG_BLOCK, &set, NULL) with set = {SIGKILL, SIGSTOP}, then sigprocmask(SIG_BLOCK, NULL, &old): old contains bits 9 and 17. SIG_SETMASK and pthread_sigmask behave the same; so does the mask installed by sigsuspend (a handler that reads the mask during the suspend sees both bits).
Expected (FreeBSD 11.4 kern_sigprocmask, sys/kern/kern_sig.c:1056 and :1067): SIGKILL and SIGSTOP are removed from the set for SIG_BLOCK and SIG_SETMASK (SIG_CANTMASK); sigsuspend goes through the same call (kern_sig.c:1534). They can never be blocked.
Actual: _sigprocmask_nid_postfix and sigsuspend_nid_postfix (libkernel System/src/Signals.cpp) store the set as given.
Test: core/libs/tests/GuestSignals.cpp (new cases; guest_signals exits with 0xc0000409 before the fix).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/sigprocmask-never-block-kill-stop
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5941614244 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8405). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T12:27:38Z. --- ### Repro `sigprocmask(SIG_BLOCK, &set, NULL)` with `set` = {SIGKILL, SIGSTOP}, then `sigprocmask(SIG_BLOCK, NULL, &old)`: `old` contains bits 9 and 17. `SIG_SETMASK` and `pthread_sigmask` behave the same; so does the mask installed by `sigsuspend` (a handler that reads the mask during the suspend sees both bits). Expected (FreeBSD 11.4 `kern_sigprocmask`, sys/kern/kern_sig.c:1056 and :1067): SIGKILL and SIGSTOP are removed from the set for `SIG_BLOCK` and `SIG_SETMASK` (`SIG_CANTMASK`); `sigsuspend` goes through the same call (kern_sig.c:1534). They can never be blocked. Actual: `_sigprocmask_nid_postfix` and `sigsuspend_nid_postfix` (libkernel `System/src/Signals.cpp`) store the set as given. Test: `core/libs/tests/GuestSignals.cpp` (new cases; `guest_signals` exits with 0xc0000409 before the fix). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/sigprocmask-never-block-kill-stop AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#8405
No description provided.