feat(libkernel_sys): implement sigqueue #9389
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9389"
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 GitamarT045T3R on 2026-10-21T20:14:46Z.
What
sigqueuein libkernel_sys was aNotImplementedstub. It now follows FreeBSD 11'ssys_sigqueue:_SIG_MAXSIG), or negativeEINVALEINVALEINVAL: only a single processEINVALpfindfails,ESRCHESRCHpksignalwithSI_QUEUEand the valueraise, so ignored, blocked, default and handled signals behave as they do forkillThe signal check comes before the pid check, as in FreeBSD.
Gaps, in a new libkernel_sys debt entry: the value is dropped. libkernel delivers signals without
siginfo, sosi_codeandsi_valueare not set and anSA_SIGINFOhandler throws, as it does forraise. The limit of 128 pending queued signals per process (EAGAIN) is not modelled.Tested
Windows 10 Pro 22H2 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release,
BUILD_TESTING=ON, onmaincecb540a6:guest_sigqueuecovers:errnoalone;EINVALfor signals -1 and 129 to any pid, and for pids 0, -1 and the negated guest pid;ESRCHfor other pids, including with signal 0;sigqueuereturns;mainthe first call throwssigqueue_nid_postfix not implemented.guest_killandguest_kernel_sysstill pass.python tools/check_conventions.py --base origin/mainpasses.getpidandraise.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T20:15:37Z.
Progress report (
4777cac→3a75bf4)📈 System libraries: 43.25% (+0.02%, +2 implemented functions)
✅ 2 implemented
sigqueue_nid_disambig1_nid_postfixsigqueue_nid_postfixImported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-21T23:40:17Z.
Linux run, the platform the description doesn't list.
Head
02d83c7076merged onto maina6dcea927(clean). WSL2 Ubuntu 24.04, GCC 13.3.0, Release.guest_sigqueue,guest_kill,guest_signals,guest_signal_list,guest_signal_sets: 5/5, 3 runs.libkernel_sys/Export.cppandExport.Discovery.cppfrom main,guest_sigqueueaborts (sigqueue_nid_postfix not implemented).check_conventions.py --base a6dcea927: passes.kern_sigqueue:(u_int)signum > _SIG_MAXSIGandpid <= 0giveEINVALbeforepfindgivesESRCH, and signal 0 sends nothing.sigqueue(TJG6tf+yJlY) is in the PS5 3.20 libkernel export list as well as libkernel_sys (libkernel.c L8893, libkernel_sys.c L9947). On Windows a libkernel import does not search libkernel_sys (core/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp:175-177adds libkernel only for libkernel_sys/libkernel_web imports). So a title that importssigqueuefrom libkernel will not reach this implementation; #9379 movedswapcontextinto libkernel for the same reason.AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T23:59:32Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyguest_sigqueue_tests;ctest -N -R guest_sigqueuelists exactly one test.PR head tested:
02d83c7076be46b4a6daea6d198e797619bfafb6.Results (3 runs each):
guest_sigqueuepasses 3/3.core/libs/prx/libkernel_sys/Export.Discovery.cpp,core/libs/prx/libkernel_sys/Export.cppwith the version from the PR's merge base (cecb540a63), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.GPU: the run output has no
Selected GPUline; no GPU claim is made.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T06:16:32Z.
Review: DISMISSED
Changes requested The new implementation is registered only in
libkernel_sys, butsigqueueis exported by bothlibkernel_sysandlibkernelin the PS5 3.20 export inventory (same NID,TJG6tf+yJlY). A title importing that NID fromlibkernelwill therefore still hit the unimplemented path. The current Windows import fallback addslibkernelwhen resolving imports fromlibkernel_sysorlibkernel_web; it does not addlibkernel_syswhen resolving imports fromlibkernel. The current tree likewise has nosigqueueimplementation/export incore/libs/prx/libkernel. Please cover thelibkernelexport too, with a test that imports through each module, or provide repository-specific evidence that thelibkernelexport is not required and adjust the stated scope accordingly. The independent PS5 export-inventory references are in the Linux test report comment above; the relevant fallback iscore/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp. ## Base and overlap coordinationI withdraw the queue-based intake hold. It is fine to keep submitting PRs; maintainers will handle them in due course.
The PR is also substantially behind current
main(the checked base isd6732b51a64f4322799af89b876b224d3aed6efc; this head is 588 commits behind and 1 ahead). Please rebase/update and rerun checks before requesting another review. The overlap report also flags the sharedlibkernel_sysdebt entry with #9195 and cannot compare multiple shared CMake/Export.cppfiles due to base conflicts; manually coordinate those changes after updating. ## Checks observed -python3 tools/check_conventions.py --base upstream/main: passed. -git diff --check upstream/main...refs/review/9389: passed. - Local Linuxguest_sigqueue_teststarget: built successfully. - Localguest_sigqueueruntime: could not execute; the host CPU lacks LZCNT, BMI1, BMI2, MOVBE, AVX2, and FMA, which the project requires. - Existing hosted eligibility, conventions, intake, labels, and report checks passed on this PR head. Product build jobs were skipped. - The PR and independent Windows/WSL2 reports provide additional platform runs; I did not reproduce those locally.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-22T08:26:38Z.
@MarcZX10 thanks for catching the libkernel export. Rebased onto
maind6eafa54d, plusbddbe58a2:sigqueueis now implemented in libkernel, next tokillinSignals.cpp, assigqueue_nid_disambig1, so it exports the same NIDTJG6tf+yJlY. That is howfstatandpwriteare shared between the two modules.sigqueueforwards to libkernel's, so both imports reach one implementation.guest_sigqueuenow runs every check through both exports.libkernel.md, so this no longer shares the libkernel_sys debt hunk with #9195.Tested:
guest_sigqueue,guest_kill,guest_signalsandguest_kernel_syspass, andcheck_conventionspasses.libkernel.prxexportsTJG6tf+yJlY.libkernel_sys.prxexports it and imports it fromlibkernel.prx.git merge-treeagainst the open PRs that touch these files finds no new conflicts.On intake: no title is known to need
sigqueueyet, so I leave it to the maintainers whether this waits under the #5239 guidance.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T09:32:32Z.
Review: COMMENTED
Ran
bddbe58a2on native Linux (Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, Release, merged--no-commitontoorigin/main7e2ba73e4).guest_sigqueue,guest_kill,guest_signals,guest_kernel_sysandpatched_librariespass.One problem with the new forwarder on the NID-patched libraries. After patching,
libkernel_sys.prxboth exportsTJG6tf+yJlYand imports it (itssigqueue_nid_postfixisjmp TJG6tf+yJlY@plt):There's no symbol versioning, so that import binds to the first
TJG6tf+yJlYin the lookup scope. Iflibkernel_sys.prxcomes beforelibkernel.prx, it binds to itself andsigqueuenever returns. The relinker keeps the title'sDT_NEEDEDorder, so a title that listslibkernel_sysfirst hits this. A minimal executable linked against the patched.prxfiles, which looks upTJG6tf+yJlYand calls it with(-1, 1, nullptr):DT_NEEDEDlibkernel_sys.prx, libkernel.prx: resolves tolibkernel_sys.prx, spins untiltimeout 15kills it.DT_NEEDEDlibkernel.prx, libkernel_sys.prx: resolves tolibkernel.prx, returns -1.guest_sigqueuecan't see this because it links the unpatched libraries, where the two names are still different. Calling a helper that patching leaves alone would avoid it, for exampleSigqueue_nid_no_patchin libkernel'sSignals.cppcalled by both exports, the way #9693 usesSetLogin_nid_no_patchacross the same two modules.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-22T10:37:38Z.
@jotitadev thank you, that self-binding is real: after patching, the forwarder's import and the export are both
TJG6tf+yJlY. Fixed in3a75bf461. Both exports now callGuestSigqueue_nid_no_patchin libkernel'sSignals.cpp, which patching leaves alone, asGuestAlarm_nid_no_patchis shared with libSceLibcInternal.On the NID-patched libraries (Windows build),
libkernel_sys.prxstill exportsTJG6tf+yJlYand no longer imports it. It importsGuestSigqueue_nid_no_patchfromlibkernel.prx, andlibkernel.prxexports both.guest_sigqueue,guest_kill,guest_signalsandguest_kernel_syspass, andcheck_conventionspasses.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:49:31Z.
For the record: #9682 (
settimeofday) removes the stub next tosigqueueinExport.Discovery.cpp. #9682 will go after this PR and rebase; nothing is needed here. Its checklist now says so.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T02:56:38Z.
Review: COMMENTED
Re-ran the self-binding case from my earlier review on
3a75bf461: it is fixed.Machine: Linux x86_64, i7-8700, Ubuntu 26.04, glibc 2.43, GCC 15.2, Release,
BUILD_TESTING=ON, full build. Head3a75bf461merged--no-commitontomainabed03546, with the two changes @wachi35676 described to make it build (drop thesigqueueandsettimeofdaystubs inExport.Discovery.cpp, and the three-argumentsigqueue_nid_postfixdeclaration inlibkernel_sys/include/Api.hpp).libkernel_sys.prxexportsTJG6tf+yJlYand no longer imports it. Its only related import isGuestSigqueue_nid_no_patch, whichlibkernel.prxexports next to its ownTJG6tf+yJlY.dlsym(RTLD_DEFAULT, "TJG6tf+yJlY")called with(-1, 1, nullptr):DT_NEEDEDlibkernel_sys.prx, libkernel.prx: resolves tolibkernel_sys.prx, returns -1.DT_NEEDEDlibkernel.prx, libkernel_sys.prx: resolves tolibkernel.prx, returns -1.Signals.cppandlibkernel_sys/Export.cppas inbddbe58a2(the forwarder):libkernel_sys.prximportsTJG6tf+yJlYagain, and the libkernel_sys-first executable spins untiltimeout 15kills it.guest_sigqueuestill passes on that control, since it links the unpatched libraries.guest_sigqueue3/3.guest_sigqueue,guest_kill,guest_signals,guest_signal_list,guest_signal_sets,guest_kernel_sys,patched_librariesandconventions_unknown_nidspass, 8/8.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T10:49:56Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and its recorded limitations are consistent with the inspected code.
What I ran
Reviewed head
3a75bf46109389bd33cfbb9724b59b8546a47d7d. No commands or tests were run. I read the prepared description, commit list, diff, manifest, review README, and all added lines in the six changed files; I also read thesigqueuehelper context and thelibkernel_sysbuild definition. No changed file was excluded.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Linux and macOS builds and runs, PS5 behavior, and the author-reported Windows test results were not independently verified. The added implementation and test code, CMake change, and debt entry were read.
core/libs/prx/libkernel_sys/Export.Discovery.cpphas no added lines; its removed stub is visible in the diff. No changed file was excluded.To get this to a good state
Nothing is required.
Pull request closed