feat(libkernel): deliver SA_SIGINFO handlers with siginfo and ucontext, as FreeBSD 11 does #27140
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27140"
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 kiansaeidnia on 2026-11-25T08:23:00Z.
What
An
SA_SIGINFOhandler threwNotImplementedwhenever it was delivered. It is now called ashandler(sig, info, uc)on every synchronous delivery path:raise,killof the process,pthread_kill,pause,sigsuspend, and unblocking a pending signal.infois the 80-byte FreeBSDsiginfo_tthatsigtimedwaitalready fills. Itssi_codeisSI_LWPforraise/pthread_kill,SI_USERforkill, or the queued code such asSI_TIMERwith its value, timer id and overrun.ucis captured withgetcontextat the delivery point. Itsuc_sigmaskis the mask from before the delivery. Undersigsuspendthat is the masksigsuspendreplaced plus the blocks of an outer handler, like FreeBSD'std_oldsigmask.uc_stackcomes fromsigaltstack.uc_sigmaskbecomes the mask on return, as FreeBSD 11'ssendsig/sys_sigreturndo. A changeduc_mcontextthat switches to another context resumes throughsigreturnafter the handler's blocks are released.uc_mcontextthat keeps the delivery point's%ripor%rspthrows, because those registers belong to libkernel and not to the system call.sigsuspendputs its previous mask back when a delivery throws.Host signals still do not reach
SA_SIGINFOhandlers, and the debt entries say so.Tested
Windows 11, MinGW-w64 GCC 16.2, Release:
guest_signals,guest_signal_context,guest_signal_interrupt,guest_kernel_sigset_pause,guest_signal_handler_mask,guest_kernel_sig_pending,guest_kernel_sigpending_mask,guest_underscore_entries,guest_sigvec,guest_kernel_sigaction_setsandguest_sigtimedwaitall pass (11/11, run twice); the first ten were also run onmainand pass there.guest_signalschecks:SI_LWP/SI_USER/SI_TIMERcontents,si_pid,mc_lenanduc_sigmask;SA_NODEFERandSA_RESETHAND(0x4);sigsuspend, andpausewoken by another thread'spthread_kill;sigsuspendinside a handler, whose innerSA_SIGINFOhandler sees and edits the outer blocks;uc_sigmask, a context switch out of the handler, a contextsigreturnrejects, the four delivery-frame register edits that must throw, andsigsuspendrestoring its mask after such a throw.Each new check was confirmed to fail when its fix is reverted. On
maintheraiseof anSA_SIGINFOhandler threw.The overlap check reports line conflicts in
Signals.cpp. #26653 runsSA_SIGINFOhandlers for host SIGSEGV/SIGBUS faults; this PR covers the synchronous deliveries it leaves throwing. The two touchRunHandlerand thesigactiondebt entry, so whichever merges second rebases. The conflicts with #26206, #25999 and #21463 are neighbouring lines in the pending-signal and siginfo helpers.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)🤖 Generated with Claude Code
Summary by CodeRabbit
sigsuspend.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T08:38:26Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected implementation indicates a concrete defect, and the change has substantial test coverage for the new delivery paths.
What I ran
Reviewed head
1f494a746fe90ac8f746e0a6e11300a7c4f729c7using the prepared diff andrepo_read.pyat the pinned head. No commands or tests were run; the test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run independently. The author-reported Windows 11 and MinGW-w64 GCC 16.2 results were not independently confirmed. The changed files reviewed were
core/libs/prx/libkernel/System/src/Signals.cpp,core/libs/tests/GuestSignals.cpp, anddocs/dev/debt/changes/feat-libkernel-sa-siginfo-delivery.md; none were excluded by the review bundle.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-25T22:52:58Z.
Review: COMMENTED
Tested on Windows together with #26653, which changes the same
RunHandlerinSignals.cpp.Windows 11 (10.0.26300), NVIDIA GeForce RTX 2060 (driver 621.40), WinLibs GCC 15.2, Release, on
main499d5cb699with this PR (1f494a746f), #26653 and #27330 merged locally. The two PRs conflict inRunHandler. Locally I moved its hold and release of the handler mask into a helper that both call, and left this PR's logic as it is. I'll make that change on #26653's side once this one is merged.guest_signals,guest_signal_context,guest_signal_interrupt,guest_signal_handler_mask,guest_siginfo_faultSA_SIGINFO: the launcher's full download, cache emptied firstThe download needs #26653 for the host faults; this run shows this PR keeps that path working. Not run on Linux or macOS.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-26T10:13:23Z.
Review: COMMENTED
A second title needs this: PS5SX2 (PPSA99203, vk-285-321). Its profiler sends SIGPROF to another thread with
pthread_kill, and the handler is installed withSA_SIGINFO.Windows 11 (10.0.26300), RTX 2060 (driver 621.40), WinLibs GCC 15.2, Release,
main87f0e47be5+ #27327 + #26600 + #26653 for its other stops, with the title relinked against each build and nonoautoprofflag file:1f494a746f)signal: SA_SIGINFO handlers are not delivered; 2 runs of 2guest_signals,guest_signal_context,guest_signal_interrupt,guest_signal_handler_maskandguest_siginfo_faultpass on that build.This branch now conflicts with
maininFillSiginfo: #21463 addedGuestSiAsynciothere. Locally I keptSiginfoOfand moved the asyncio cases into it:pidis 0 andvalueis copied forGuestSiAsyncio. The conflict with #26653 is resolved as in my earlier review.Not run on Linux or macOS.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T14:15:03Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes implement the described
SA_SIGINFOdelivery paths and add focused coverage; I did not run the reported checks, so a formal approval is not justified.What I ran
Reviewed head
c200c89a16330cd5f457335224bb3276a169784a. I read the prepared description, commit summary, manifest, diff, and all three changed files. I also inspected targeted context inUserContext.hpp,UserContext.cpp, andSignals.cpp. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
Sources
Not verified
The author-reported Windows 11 / MinGW test results, build status, and behavior on physical hardware were not independently verified. No files were excluded from the review among the three changed files listed in the manifest.
To get this to a good state
Nothing is required. The test results above are optional follow-up context.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T14:19:34Z.
Review: COMMENTED
Actionable comments posted: 9
4a2a5df3-3c61-4b49-803f-11d96ca49487Reviewing files that changed from the base of the PR and between
3dd06de43candc200c89a16.core/libs/prx/libkernel/System/src/Signals.cppcore/libs/tests/GuestSignals.cppdocs/dev/debt/changes/feat-libkernel-sa-siginfo-delivery.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T17:04:24Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change based on the code inspected; the author-reported tests were not run in this review.
What I ran
Reviewed head
f7ee939467693b6af6a623de70ec1021d8a80f4busingrepo_read.py. Readdescription.md,commits.md,manifest.json,diff.patch, and the complete head text of all three changed files:core/libs/prx/libkernel/System/src/Signals.cpp,core/libs/tests/GuestSignals.cpp, anddocs/dev/debt/changes/feat-libkernel-sa-siginfo-delivery.md. The reader exposed nofiles.json; the manifest lists all three files as included. No tests or builds were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The Windows 11 / MinGW-w64 test runs in the description were not independently verified. No build, test, physical-console behavior, host-signal behavior, or interaction with the overlapping pull requests was exercised.
To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.