Commit Graph
5 Commits
Author SHA1 Message Date
babyhuey 9f5b24630d fix(libkernel): return EFAULT from pselect for an unreadable timeout or signal mask
pselect read its timeout directly, passed the guest signal mask straight
to SetSignalMaskCatching_nid_no_patch, which dereferences it, and saved
and restored the descriptor sets with memcpy after a caught signal, so a
non-null pointer into unmapped or read-only memory crashed the host. It
now copies the timeout and the mask in with GuestCopyIn_nid_no_patch,
as FreeBSD's sys_pselect does before changing the mask, and saves and
restores the sets with GuestCopyIn_nid_no_patch and
GuestCopyOut_nid_no_patch, failing with EFAULT. A bad timeout or mask
leaves the thread's signal mask unchanged.
2026-10-28 12:18:17 -04:00
harisibrar1 b8b42143b1 Merge main e7e3e9c198 into fix/pselect-pending-signal-eintr 2026-10-25 01:24:28 -04:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
harisibrar1andClaude Opus 5.5 c7cd45c0da fix(libkernel): return EINTR from pselect when its mask unblocks a pending signal
FreeBSD's kern_pselect installs the mask and kern_select sleeps with
PCATCH, so a pending signal that the new mask unblocks makes the call
return EINTR once the descriptors have been scanned. Here the handler ran
inside the mask swap and select then waited the full timeout, or forever
with no timeout. The swap now reports whether a handler ran, and pselect
then scans the descriptors once without waiting: a ready descriptor, a
zero timeout or an invalid argument keep select's answer, and otherwise
the call fails with EINTR and leaves the descriptor sets unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 00:39:02 -04:00
David 360206e6db test(libkernel_sys): cover pselect timeouts, readiness, errors and the signal mask 2026-10-21 18:06:06 +01:00