libkernel: sigwaitinfo and sigtimedwait report si_code 0 for every signal; FreeBSD 11.4 reports the sender #8496

Closed
opened 2026-10-20 13:51:35 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 13:51:35 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T13:51:35Z.


Repro

Block SIGINT, send it with kill(getpid(), SIGINT), raise(SIGINT) or pthread_kill(thread, SIGINT), then sigwaitinfo(&set, &info): info.si_code is 0 each time. The same for SIGALRM from alarm/setitimer.
Expected (FreeBSD 11.4): kill queues the signal with SI_USER 0x10001 (sys/kern/kern_sig.c:1788), thr_kill, which raise and pthread_kill use, with SI_LWP 0x10007 (kern_thr.c:401; raise.c:52), and the interval timer expiry with SI_KERNEL 0x10006 and pid 0 (kern_time.c:899, kern_sig.c:2087); constants in sys/sys/signal.h:400-409.
Actual: FillSiginfo (libkernel System/src/Signals.cpp) writes GuestSiuser = 0 and the pending set keeps no sender.
Test: core/libs/tests/GuestSigtimedwait.cpp (changed expectations and new cases; guest_sigtimedwait exits with 0xc0000409 before the fix).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/siginfo-sender-code
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5942895233 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8496). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T13:51:35Z. --- ### Repro Block SIGINT, send it with `kill(getpid(), SIGINT)`, `raise(SIGINT)` or `pthread_kill(thread, SIGINT)`, then `sigwaitinfo(&set, &info)`: `info.si_code` is 0 each time. The same for SIGALRM from `alarm`/`setitimer`. Expected (FreeBSD 11.4): `kill` queues the signal with `SI_USER` 0x10001 (sys/kern/kern_sig.c:1788), `thr_kill`, which `raise` and `pthread_kill` use, with `SI_LWP` 0x10007 (kern_thr.c:401; raise.c:52), and the interval timer expiry with `SI_KERNEL` 0x10006 and pid 0 (kern_time.c:899, kern_sig.c:2087); constants in sys/sys/signal.h:400-409. Actual: `FillSiginfo` (libkernel `System/src/Signals.cpp`) writes `GuestSiuser = 0` and the pending set keeps no sender. Test: `core/libs/tests/GuestSigtimedwait.cpp` (changed expectations and new cases; `guest_sigtimedwait` exits with 0xc0000409 before the fix). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/siginfo-sender-code 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#8496
No description provided.