fix(libkernel): block guest signals by FreeBSD's bit n - 1 #1652
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1652"
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 SleglJan on 2026-10-08T15:44:29Z.
What
DispatchinSystem/src/Signals.cpptested the blocked mask with1u << guest, bit n.sigprocmaskkeeps the first word of the title's set as it is, and FreeBSD keeps signal n at bit n − 1 (_SIG_BIT), which is what FreeBSD'ssigaddset(and #1641's) produces. So a title that blocked SIGTERM (bit 14) was not protected, and a set with bit 15 blocked SIGTERM instead of SIGURG.Dispatchnow tests1u << (guest - 1). The stored mask and the setsigprocmaskreturns are unchanged, so they keep the title's layout. Nothing else interprets the mask's bits;sigprocmaskonly combines and returns it.Found while adding the sigset functions in #1641: with them a title can build such a set without importing anything else, so the mismatch stops being latent. The two are independent changes; #1641 lists this one under Depends on so they land in order.
Tested
BUILD_TESTING=ONandANYPS5_ENABLE_SPIRV_TOOLS=ONon this branch (based onmain4b005b22):ctest --repeat until-fail:3466/466;tools/check_conventions.py --base upstream/mainpasses.guest_signalsgains two cases: block{1u << 14}withSIG_BLOCK,raise(15)is not delivered,SIG_UNBLOCK,raise(15)is delivered; and block{1u << 15},raise(15)is still delivered. The first was written before the change: onmainit aborts (the raise is delivered through the block); it passes with the change. The existing round-trip assertions are untouched.guest_signals5/5 with this change, 5/5 failures withmain'sSignals.cppand the new cases, full suite 457/457. Pending delivery of a blocked signal after unblocking is not implemented here or onmain; this only corrects which bit is tested.main6b56175a), run 37822080210:guest_signalspasses its three repeats on Windows, full suite 473/473. Linux passed on a rerun afteragc_driver_buffer_formathit its 120 s limit on the software Vulkan runner (the test takes 92 to 108 s onmain's own runs; #1744).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T17:18:20Z.
Windows run, since the description says it wasn't tested there: Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7, the CI build), Release, configured like CI, Ryzen 9 5900X. This commit merged onto
main7995d657, which merges cleanly.guest_signalsSignals.cppfrommain, new cases keptSo the bit
n − 1check also holds on the CRTsignal/raisepath thatDispatchuses on Windows: SIGTERM blocked through bit 14 isn't delivered, and bit 15 no longer blocks it.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T17:24:29Z.
Thanks for the Windows run; the description now points to it, so the CRT path is covered on both hosts.
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-09T23:54:47Z.
Rebased onto
mainff8961df(headc26c1cae). #1916 (sigaction) and this PR both append cases toGuestSignals.cpp; both are kept, this PR's 12 lines after #1916's, with its two set variables renamed becausetermwas taken. TheSignals.cppchange is the same one line, andmainstill tests1u << guest.Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, on this head:guest_signalsandguest_signal_setspass three repeats;check_conventions.py --base upstream/mainpasses.agc_driver_dcc_keys_first_write(#2188, NVIDIA proprietary driver), which passes three repeats on RADV.mainff8961df, run 38005245415: relinker green on all three platforms; linux 536 passed, 29 skipped, 1 failed of 566 withguest_signalsandguest_signal_setsamong the passed, the failureguest_video_out_resolution_status(#1714) aborting on the runner's offscreen SDL driver without Vulkan; windows stops atlibSceVideoOut.prxwith #2462's duplicate export. The fork's build ofmainff8961dfalone, run 38004711062, fails the same two ways with the same 29 skips.AI-assisted: yes (Claude Code)