fix(libkernel): fail sigemptyset, sigfillset, sigaddset, sigdelset, sigismember with EFAULT on an unusable set #15508
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15508"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-11-03T16:36:51Z.
What
sigemptyset,sigfillset,sigaddset,sigdelsetandsigismemberin libkernel wrote or read the guest signal set through the raw pointer, and a null set threwstd::invalid_argumentbefore the signal number was looked at. A non-null unusable pointer such as 0x10 faulted the host. They now copy the 16-byte set withGuestCopyIn_nid_no_patch/GuestCopyOut_nid_no_patchand fail with -1 andEFAULTwhen the set cannot be read or written.This is a host-safety fix, not console behaviour. FreeBSD 11.4's
sigsetops.cworks on the set in user space with no system call, so a bad pointer faults a console process and sets no errno;EFAULTwas not measured on a console. The entry is indocs/dev/debt/libkernel.md.The signal check stays first, as in the source:
sigaddset,sigdelsetandsigismemberwith a signal outside 1 to 128 giveEINVALwithout touching the set, so a null set with signal 0 givesEINVAL, notEFAULT.sigemptysetandsigfillsethave no error in the source and only reportEFAULT.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, on currentmain.guest_signal_sets: newCheckBadPointerscovers a null set, 0x10, aPROT_NONEpage, a read-only page (sigismembersucceeds, the four writers fail and leave the set unchanged), a set straddling a readable and an unreadable page, andEINVALbeforeEFAULTfor signals 0, -1 and 129. Onmainthe test aborts; with this change it passes, three runs out of three.agc_*timeouts under load); rerun alone, 20 pass and 3 fail.vulkan_validation_gate_reportsandcheck_compile_test_windows_gcc_response_text_mode_is_not_reinterpretedfail because of the WindowsApps Python on this machine, andagc_driver_store_over_untrackedfails the same way withSignalSets.cppreverted tomain.python tools/check_conventions.py --base upstream/main: passes.Overlaps
tools/pr_overlap.pyreports no conflicting file or export. It lists #12682, #12688, #12700 and #12965 as sharingSignalSets.cppandGuestSignalSets.cppwithout comparing them, because those PRs conflict withmainthemselves; their hunks inSignalSets.cppare in thesigsetjmp/siglongjmpassembly below the five functions changed here, and their test changes are elsewhere inGuestSignalSets.cpp, so there is no overlapping line. The other listed PRs only append todocs/dev/debt/libkernel.md.Checklist
main; no other open PR implements the same functionNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code