feat(libkernel): export _sigintr and let signal honour it #8866
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8866"
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 ycbuzi on 2026-10-21T03:43:13Z.
What
libkernel.prxexports_sigintr(nQVWJEGHObc), thesigset_tthat FreeBSD's libc shares betweensignalandsiginterrupt:signalgives a handlerSA_RESTARTunless its signal is in the set (lib/libc/gen/signal.c, 11.4). The public SDK's libkernel, libkernel_sys and libkernel_web stub tables declare the object, and no built library provided it, so a registry importing it was reported absent (#8846). The object is 16 bytes (fouruint32, the SDK'ssys/_sigset.h), zero at start, andsignalnow reads it under the registration lock when it records a handler.Not included:
siginterrupt, which fills the set. On the console it is a libSceLibcInternal export (the SDK'slibSceLibcInternal.cdeclares it; the three kernel tables do not), which AnyPS5 serves fromlibc.prx, andlibc.prxdoes not linklibkernel.prx(the dependency runs the other way), so it cannot reach the dispositions. A guest that writes the set itself gets FreeBSD's behaviour fromsignal; the function needs a decision on how libc reaches libkernel's signal state and is left for a follow-up. A debt entry forsignalsays so. Whether the two kernel variants should provide the object as well is the policy question of #8853.Tested
Windows 11, MinGW GCC 15.2.0, Release,
BUILD_TESTING=ON, onmain05f9995704:guest_signals, extended: the set starts zero;signalrecordsSA_RESTART; with bit 29 set (signal 30) it records flags 0 and keeps the handler; signal 31 still getsSA_RESTART; bit 127 (signal 128) clears it the same way; with the bits clearedSA_RESTARTcomes back.guest_signalspasses (1 of 1).signalchange alone restored tomain(object and test kept) the test fails at the first flags-0 check; restored, it passes. It exits with0xc0000409(theRequireabort) on the reverted build and passes again on the restored one.tools/import_audit.pyon #8846's one-line registry against the built libraries:implemented 1, absent 0, exit 0 (the issue measuredabsent 1).python tools/check_conventions.py --base origin/main --head HEADpasses.sigaction, a few lines below the changed line insignal, and #8700 adds entry points aftersigactionandsigsuspend; whichever merges second rebases a few lines. Neither touches_sigintr.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)_sigintrimport of #8846;siginterruptstays open there)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T04:24:41Z.
Manual review of the overlap warning: #3986 changes the signal masks,
raise, and early portions ofGuestSignals.cpp; this PR’s production change is insignal_nid_postfix, and its test block is appended at the end, so those hunks are separate. #7201 only changes macOS alarm exception handling inSignals.cpp; #7622 only changes alarm-thread startup. The debt-file warnings are separate entries. I found no conflicting edits in those overlaps. #8872 is correctly listed as depending on this PR.Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T04:30:59Z.
Thanks for checking the overlaps by hand. Agreed on the hunks: this PR's production change is the one line in
signalplus the object, and the test block only appends; the debt entry stays separate from the others on a rebase.Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T20:41:05Z.
Console measurement (PS5 FTP
192.168.0.144,/system/common/lib). Parsed each modulesDT_SYMTAB/DT_STRTAB` (no Ghidra)._sigintr(nQVWJEGHObc)st_infost_sizelibkernel.sprxf89a698bf7a0…STT_OBJECTSTB_GLOBALlibkernel_sys.sprx60921322b155…STT_OBJECTSTB_GLOBALlibkernel_web.sprx4ab93ee107e8…STT_OBJECTSTB_GLOBALString form in those modules is
nQVWJEGHObc#I#A. That matches a 16-bytesigset_t(fouruint32words) and the FreeBSD zero-init lead in #8846.Related
libSceLibcInternal.sprxhasnQVWJEGHObc#A#Bas an undefined import (st_size0,shndx0), not a provider.siginterrupt(TsrS8nGDQok) is aSTT_FUNCin LibcInternal (st_size128) and is absent from the three kernel modules` dynsym — consistent with putting the function in libc and the bitmap in libkernel (#8872 / #8866 split).No title run. AI-assisted parse of the pulled SPRX files.
Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T21:42:46Z.
Console
siginterrupt(TsrS8nGDQok) inlibSceLibcInternal.sprx, Ghidra 12.1.4 headless decompile (x86:LE:64:default:gcc), plus NID resolve:st_size128)._sigintr(nQVWJEGHObc) and callssigaddset(JUimFtKe0Kc).sigactionquery → ifflag==0clear bit in_sigintrand setSA_RESTART(|= 2), else set bit and clearSA_RESTART(&= ~2) →sigactioninstall. Stack cookie viaf7uOxY9mM1U/Ou3iL1abvng.This is static evidence from the pulled firmware module; no title run. Aligns with #8866/#8872’s FreeBSD-shaped split (bitmap in libkernel, function in libc).
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T00:50:25Z.
@ycbuzi a merge-order note: #9499 adds a
SettleReset(guest)call tosignal_nid_postfix, right before the action line this PR changes to honour_sigintr. Both lines stay, so the two compose. This one goes first: #9499 lists it under Depends on and rebases on it.Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T05:47:35Z.
Review: APPROVED
Checked against main
4a17c7175and FreeBSD 11.4lib/libc/gen/signal.c:signalsetsSA_RESTARTonly when the signal is not in_sigintr(!sigismember(&_sigintr, s)), and that is whatSignals.cpp:488does.SignalInSet's word/bit mapping matches_SIG_WORD/_SIG_BIT, so signal 128 lands onbits[3]bit 31 as the test expects._sigintr_nid_postfixis a plainextern "C"16-byte zero-initialised global. Main already exports data objects the same way (optind,signgam), and it fits the STT_OBJECT, 16-byte, BSS measurement above.sigactionentry indocs/dev/debt/libkernel.mdstill sayssignalrecords its handler "withSA_RESTARTand an empty mask". That is now true only when the signal is not in_sigintr. Adding "(unless the signal is in_sigintr, seesignalbelow)" would keep the two entries consistent.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-22T06:14:59Z.
Thanks for the review and the check against signal.c. I left the
sigactionentry as it is: it's already 1,426 characters onmain, overcheck_conventions.py's 1,000-characterdebt-lengthlimit, so editing it here would make this PR carry that warning. Thesignalentry right below states the_sigintrexception.