feat(libkernel_sys): implement sigqueue #9389

Closed
GitamarT045T3R wants to merge 3 commits from upstream-pr/9389 into main
GitamarT045T3R commented 2026-10-21 20:14:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-21T20:14:46Z.


What

sigqueue in libkernel_sys was a NotImplemented stub. It now follows FreeBSD 11's sys_sigqueue:

Case FreeBSD 11 Now
signal above 128 (_SIG_MAXSIG), or negative EINVAL EINVAL
pid 0 or below EINVAL: only a single process EINVAL
a pid that is not the guest pfind fails, ESRCH ESRCH
signal 0 checks only returns 0, sends nothing
the guest's own pid pksignal with SI_QUEUE and the value libkernel's raise, so ignored, blocked, default and handled signals behave as they do for kill

The 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, so si_code and si_value are not set and an SA_SIGINFO handler throws, as it does for raise. 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, on main cecb540a6:

  • New guest_sigqueue covers:
    • signal 0 to the guest, with and without a value, succeeds and leaves errno alone;
    • EINVAL for signals -1 and 129 to any pid, and for pids 0, -1 and the negated guest pid;
    • ESRCH for other pids, including with signal 0;
    • an ignored signal is not delivered;
    • a handled signal reaches its handler before sigqueue returns;
    • a failed call delivers nothing.
  • On main the first call throws sigqueue_nid_postfix not implemented.
  • guest_kill and guest_kernel_sys still pass.
  • python tools/check_conventions.py --base origin/main passes.
  • Not built or run on Linux or macOS. The code has no host-specific paths: it goes through libkernel's getpid and raise.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4957746526 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389). Originally posted by [GitamarT045T3R](https://github.com/GitamarT045T3R) on 2026-10-21T20:14:46Z. --- ### What `sigqueue` in libkernel_sys was a `NotImplemented` stub. It now follows FreeBSD 11's [`sys_sigqueue`](https://github.com/freebsd/freebsd-src/blob/34bd34750187bae02a0086402c78c031c59dd8b3/sys/kern/kern_sig.c#L1839-L1873): | Case | FreeBSD 11 | Now | | --- | --- | --- | | signal above 128 (`_SIG_MAXSIG`), or negative | `EINVAL` | `EINVAL` | | pid 0 or below | `EINVAL`: only a single process | `EINVAL` | | a pid that is not the guest | `pfind` fails, `ESRCH` | `ESRCH` | | signal 0 | checks only | returns 0, sends nothing | | the guest's own pid | `pksignal` with `SI_QUEUE` and the value | libkernel's `raise`, so ignored, blocked, default and handled signals behave as they do for `kill` | The 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`, so `si_code` and `si_value` are not set and an `SA_SIGINFO` handler throws, as it does for `raise`. 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`, on `main` `cecb540a6`: - New `guest_sigqueue` covers: - signal 0 to the guest, with and without a value, succeeds and leaves `errno` alone; - `EINVAL` for signals -1 and 129 to any pid, and for pids 0, -1 and the negated guest pid; - `ESRCH` for other pids, including with signal 0; - an ignored signal is not delivered; - a handled signal reaches its handler before `sigqueue` returns; - a failed call delivers nothing. - On `main` the first call throws `sigqueue_nid_postfix not implemented`. - `guest_kill` and `guest_kernel_sys` still pass. - `python tools/check_conventions.py --base origin/main` passes. - Not built or run on Linux or macOS. The code has no host-specific paths: it goes through libkernel's `getpid` and `raise`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-21 20:15:37 +00:00 (Migrated from github.com)

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
Library Name
libkernel sigqueue_nid_disambig1_nid_postfix
libkernel_sys sigqueue_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6325584047 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6325584047). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T20:15:37Z. --- <!-- progress-report --> ### Progress report (4777cac → 3a75bf4) 📈 **System libraries**: 43.25% (+0.02%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libkernel | `sigqueue_nid_disambig1_nid_postfix` | | libkernel_sys | `sigqueue_nid_postfix` | </details>
wachi35676 commented 2026-10-21 23:40:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-21T23:40:17Z.


Linux run, the platform the description doesn't list.

Head 02d83c7076 merged onto main a6dcea927 (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.
  • Negative control: with libkernel_sys/Export.cpp and Export.Discovery.cpp from main, guest_sigqueue aborts (sigqueue_nid_postfix not implemented).
  • check_conventions.py --base a6dcea927: passes.
  • The checks match FreeBSD 11.4 kern_sigqueue: (u_int)signum > _SIG_MAXSIG and pid <= 0 give EINVAL before pfind gives ESRCH, 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-177 adds libkernel only for libkernel_sys/libkernel_web imports). So a title that imports sigqueue from libkernel will not reach this implementation; #9379 moved swapcontext into libkernel for the same reason.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329020004 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6329020004). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-21T23:40:17Z. --- Linux run, the platform the description doesn't list. Head `02d83c7076` merged onto main `a6dcea927` (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. - Negative control: with `libkernel_sys/Export.cpp` and `Export.Discovery.cpp` from main, `guest_sigqueue` aborts (`sigqueue_nid_postfix not implemented`). - `check_conventions.py --base a6dcea927`: passes. - The checks match FreeBSD 11.4 `kern_sigqueue`: `(u_int)signum > _SIG_MAXSIG` and `pid <= 0` give `EINVAL` before `pfind` gives `ESRCH`, and signal 0 sends nothing. `sigqueue` (`TJG6tf+yJlY`) is in the PS5 3.20 libkernel export list as well as libkernel_sys ([libkernel.c](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libkernel.c) L8893, [libkernel_sys.c](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libkernel_sys.c) L9947). On Windows a libkernel import does not search libkernel_sys (`core/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp:175-177` adds libkernel only for libkernel_sys/libkernel_web imports). So a title that imports `sigqueue` from libkernel will not reach this implementation; #9379 moved `swapcontext` into libkernel for the same reason. AI-assisted: yes (Claude Code); results above were run on this machine.
xXPBSXx commented 2026-10-21 23:59:32 +00:00 (Migrated from github.com)

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 main is clean. I built only guest_sigqueue_tests; ctest -N -R guest_sigqueue lists exactly one test.

PR head tested: 02d83c7076be46b4a6daea6d198e797619bfafb6.

Results (3 runs each):

  • PR head: guest_sigqueue passes 3/3.
  • Baseline: I kept the PR's test and replaced only these production files: core/libs/prx/libkernel_sys/Export.Discovery.cpp, core/libs/prx/libkernel_sys/Export.cpp with 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 GPU line; 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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329273247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6329273247). Originally posted by [xXPBSXx](https://github.com/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 `main` is clean. I built only `guest_sigqueue_tests`; `ctest -N -R guest_sigqueue` lists exactly one test. **PR head tested:** `02d83c7076be46b4a6daea6d198e797619bfafb6`. **Results (3 runs each):** - PR head: `guest_sigqueue` passes 3/3. - Baseline: I kept the PR's test and replaced only these production files: `core/libs/prx/libkernel_sys/Export.Discovery.cpp`, `core/libs/prx/libkernel_sys/Export.cpp` with 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 GPU` line; 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).
MarcZX10 commented 2026-10-22 06:16:32 +00:00 (Migrated from github.com)

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, but sigqueue is exported by both libkernel_sys and libkernel in the PS5 3.20 export inventory (same NID, TJG6tf+yJlY). A title importing that NID from libkernel will therefore still hit the unimplemented path. The current Windows import fallback adds libkernel when resolving imports from libkernel_sys or libkernel_web; it does not add libkernel_sys when resolving imports from libkernel. The current tree likewise has no sigqueue implementation/export in core/libs/prx/libkernel. Please cover the libkernel export too, with a test that imports through each module, or provide repository-specific evidence that the libkernel export 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 is core/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp. ## Base and overlap coordination

I 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 is d6732b51a64f4322799af89b876b224d3aed6efc; 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 shared libkernel_sys debt entry with #9195 and cannot compare multiple shared CMake/Export.cpp files 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 Linux guest_sigqueue_tests target: built successfully. - Local guest_sigqueue runtime: 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609996581 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#pullrequestreview-5609996581). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T06:16:32Z. **Review:** DISMISSED --- ## Changes requested The new implementation is registered only in `libkernel_sys`, but `sigqueue` is exported by both `libkernel_sys` and `libkernel` in the PS5 3.20 export inventory (same NID, `TJG6tf+yJlY`). A title importing that NID from `libkernel` will therefore still hit the unimplemented path. The current Windows import fallback adds `libkernel` when resolving imports from `libkernel_sys` or `libkernel_web`; it does not add `libkernel_sys` when resolving imports from `libkernel`. The current tree likewise has no `sigqueue` implementation/export in `core/libs/prx/libkernel`. Please cover the `libkernel` export too, with a test that imports through each module, or provide repository-specific evidence that the `libkernel` export 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 is `core/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp`. ## Base and overlap coordination I 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 is `d6732b51a64f4322799af89b876b224d3aed6efc`; 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 shared `libkernel_sys` debt entry with #9195 and cannot compare multiple shared CMake/`Export.cpp` files 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 Linux `guest_sigqueue_tests` target: built successfully. - Local `guest_sigqueue` runtime: 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.
GitamarT045T3R commented 2026-10-22 08:26:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-22T08:26:38Z.


@MarcZX10 thanks for catching the libkernel export. Rebased onto main d6eafa54d, plus bddbe58a2:

  • libkernel: sigqueue is now implemented in libkernel, next to kill in Signals.cpp, as sigqueue_nid_disambig1, so it exports the same NID TJG6tf+yJlY. That is how fstat and pwrite are shared between the two modules.
  • libkernel_sys: its sigqueue forwards to libkernel's, so both imports reach one implementation.
  • Test: guest_sigqueue now runs every check through both exports.
  • Debt entry: moved to libkernel.md, so this no longer shares the libkernel_sys debt hunk with #9195.

Tested:

  • On Windows, guest_sigqueue, guest_kill, guest_signals and guest_kernel_sys pass, and check_conventions passes.
  • The NID-patched libkernel.prx exports TJG6tf+yJlY. libkernel_sys.prx exports it and imports it from libkernel.prx.
  • git merge-tree against the open PRs that touch these files finds no new conflicts.

On intake: no title is known to need sigqueue yet, so I leave it to the maintainers whether this waits under the #5239 guidance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336286200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6336286200). Originally posted by [GitamarT045T3R](https://github.com/GitamarT045T3R) on 2026-10-22T08:26:38Z. --- @MarcZX10 thanks for catching the libkernel export. Rebased onto `main` `d6eafa54d`, plus bddbe58a2: - **libkernel:** `sigqueue` is now implemented in libkernel, next to `kill` in `Signals.cpp`, as `sigqueue_nid_disambig1`, so it exports the same NID `TJG6tf+yJlY`. That is how `fstat` and `pwrite` are shared between the two modules. - **libkernel_sys:** its `sigqueue` forwards to libkernel's, so both imports reach one implementation. - **Test:** `guest_sigqueue` now runs every check through both exports. - **Debt entry:** moved to `libkernel.md`, so this no longer shares the libkernel_sys debt hunk with #9195. **Tested:** - On Windows, `guest_sigqueue`, `guest_kill`, `guest_signals` and `guest_kernel_sys` pass, and `check_conventions` passes. - The NID-patched `libkernel.prx` exports `TJG6tf+yJlY`. `libkernel_sys.prx` exports it and imports it from `libkernel.prx`. - `git merge-tree` against the open PRs that touch these files finds no new conflicts. On intake: no title is known to need `sigqueue` yet, so I leave it to the maintainers whether this waits under the #5239 guidance.
jotitadev commented 2026-10-22 09:32:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T09:32:32Z.

Review: COMMENTED


Ran bddbe58a2 on native Linux (Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, Release, merged --no-commit onto origin/main 7e2ba73e4). guest_sigqueue, guest_kill, guest_signals, guest_kernel_sys and patched_libraries pass.

One problem with the new forwarder on the NID-patched libraries. After patching, libkernel_sys.prx both exports TJG6tf+yJlY and imports it (its sigqueue_nid_postfix is jmp TJG6tf+yJlY@plt):

$ readelf -W --dyn-syms build/core/libs/libs/libkernel_sys.prx | grep TJG6tf+yJlY
    76: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND TJG6tf+yJlY
   357: 000000000000df30     9 FUNC    GLOBAL DEFAULT   13 TJG6tf+yJlY

There's no symbol versioning, so that import binds to the first TJG6tf+yJlY in the lookup scope. If libkernel_sys.prx comes before libkernel.prx, it binds to itself and sigqueue never returns. The relinker keeps the title's DT_NEEDED order, so a title that lists libkernel_sys first hits this. A minimal executable linked against the patched .prx files, which looks up TJG6tf+yJlY and calls it with (-1, 1, nullptr):

  • DT_NEEDED libkernel_sys.prx, libkernel.prx: resolves to libkernel_sys.prx, spins until timeout 15 kills it.
  • DT_NEEDED libkernel.prx, libkernel_sys.prx: resolves to libkernel.prx, returns -1.

guest_sigqueue can'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 example Sigqueue_nid_no_patch in libkernel's Signals.cpp called by both exports, the way #9693 uses SetLogin_nid_no_patch across the same two modules.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5612111116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#pullrequestreview-5612111116). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T09:32:32Z. **Review:** COMMENTED --- Ran bddbe58a2 on native Linux (Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, Release, merged `--no-commit` onto `origin/main` 7e2ba73e4). `guest_sigqueue`, `guest_kill`, `guest_signals`, `guest_kernel_sys` and `patched_libraries` pass. One problem with the new forwarder on the NID-patched libraries. After patching, `libkernel_sys.prx` both exports `TJG6tf+yJlY` and imports it (its `sigqueue_nid_postfix` is `jmp TJG6tf+yJlY@plt`): ``` $ readelf -W --dyn-syms build/core/libs/libs/libkernel_sys.prx | grep TJG6tf+yJlY 76: 0000000000000000 0 FUNC GLOBAL DEFAULT UND TJG6tf+yJlY 357: 000000000000df30 9 FUNC GLOBAL DEFAULT 13 TJG6tf+yJlY ``` There's no symbol versioning, so that import binds to the first `TJG6tf+yJlY` in the lookup scope. If `libkernel_sys.prx` comes before `libkernel.prx`, it binds to itself and `sigqueue` never returns. The relinker keeps the title's `DT_NEEDED` order, so a title that lists `libkernel_sys` first hits this. A minimal executable linked against the patched `.prx` files, which looks up `TJG6tf+yJlY` and calls it with `(-1, 1, nullptr)`: - `DT_NEEDED` libkernel_sys.prx, libkernel.prx: resolves to `libkernel_sys.prx`, spins until `timeout 15` kills it. - `DT_NEEDED` libkernel.prx, libkernel_sys.prx: resolves to `libkernel.prx`, returns -1. `guest_sigqueue` can'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 example `Sigqueue_nid_no_patch` in libkernel's `Signals.cpp` called by both exports, the way #9693 uses `SetLogin_nid_no_patch` across the same two modules. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
GitamarT045T3R commented 2026-10-22 10:37:38 +00:00 (Migrated from github.com)

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 in 3a75bf461. Both exports now call GuestSigqueue_nid_no_patch in libkernel's Signals.cpp, which patching leaves alone, as GuestAlarm_nid_no_patch is shared with libSceLibcInternal.

On the NID-patched libraries (Windows build), libkernel_sys.prx still exports TJG6tf+yJlY and no longer imports it. It imports GuestSigqueue_nid_no_patch from libkernel.prx, and libkernel.prx exports both. guest_sigqueue, guest_kill, guest_signals and guest_kernel_sys pass, and check_conventions passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6338712256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6338712256). Originally posted by [GitamarT045T3R](https://github.com/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 in 3a75bf461. Both exports now call `GuestSigqueue_nid_no_patch` in libkernel's `Signals.cpp`, which patching leaves alone, as `GuestAlarm_nid_no_patch` is shared with libSceLibcInternal. On the NID-patched libraries (Windows build), `libkernel_sys.prx` still exports `TJG6tf+yJlY` and no longer imports it. It imports `GuestSigqueue_nid_no_patch` from `libkernel.prx`, and `libkernel.prx` exports both. `guest_sigqueue`, `guest_kill`, `guest_signals` and `guest_kernel_sys` pass, and `check_conventions` passes.
Gruzzberry commented 2026-10-22 11:49:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:49:31Z.


For the record: #9682 (settimeofday) removes the stub next to sigqueue in Export.Discovery.cpp. #9682 will go after this PR and rebase; nothing is needed here. Its checklist now says so.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340011097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#issuecomment-6340011097). Originally posted by [Gruzzberry](https://github.com/Gruzzberry) on 2026-10-22T11:49:31Z. --- For the record: #9682 (`settimeofday`) removes the stub next to `sigqueue` in `Export.Discovery.cpp`. #9682 will go after this PR and rebase; nothing is needed here. Its checklist now says so.
jotitadev commented 2026-10-27 02:56:38 +00:00 (Migrated from github.com)

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. Head 3a75bf461 merged --no-commit onto main abed03546, with the two changes @wachi35676 described to make it build (drop the sigqueue and settimeofday stubs in Export.Discovery.cpp, and the three-argument sigqueue_nid_postfix declaration in libkernel_sys/include/Api.hpp).

  • NID-patched libraries: libkernel_sys.prx exports TJG6tf+yJlY and no longer imports it. Its only related import is GuestSigqueue_nid_no_patch, which libkernel.prx exports next to its own TJG6tf+yJlY.
  • Same minimal executable as before, dlsym(RTLD_DEFAULT, "TJG6tf+yJlY") called with (-1, 1, nullptr):
    • DT_NEEDED libkernel_sys.prx, libkernel.prx: resolves to libkernel_sys.prx, returns -1.
    • DT_NEEDED libkernel.prx, libkernel_sys.prx: resolves to libkernel.prx, returns -1.
  • Control, with Signals.cpp and libkernel_sys/Export.cpp as in bddbe58a2 (the forwarder): libkernel_sys.prx imports TJG6tf+yJlY again, and the libkernel_sys-first executable spins until timeout 15 kills it. guest_sigqueue still passes on that control, since it links the unpatched libraries.
  • guest_sigqueue 3/3. guest_sigqueue, guest_kill, guest_signals, guest_signal_list, guest_signal_sets, guest_kernel_sys, patched_libraries and conventions_unknown_nids pass, 8/8.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661710724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#pullrequestreview-5661710724). Originally posted by [jotitadev](https://github.com/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. Head `3a75bf461` merged `--no-commit` onto `main` `abed03546`, with the two changes @wachi35676 described to make it build (drop the `sigqueue` and `settimeofday` stubs in `Export.Discovery.cpp`, and the three-argument `sigqueue_nid_postfix` declaration in `libkernel_sys/include/Api.hpp`). - NID-patched libraries: `libkernel_sys.prx` exports `TJG6tf+yJlY` and no longer imports it. Its only related import is `GuestSigqueue_nid_no_patch`, which `libkernel.prx` exports next to its own `TJG6tf+yJlY`. - Same minimal executable as before, `dlsym(RTLD_DEFAULT, "TJG6tf+yJlY")` called with `(-1, 1, nullptr)`: - `DT_NEEDED` libkernel_sys.prx, libkernel.prx: resolves to `libkernel_sys.prx`, returns -1. - `DT_NEEDED` libkernel.prx, libkernel_sys.prx: resolves to `libkernel.prx`, returns -1. - Control, with `Signals.cpp` and `libkernel_sys/Export.cpp` as in `bddbe58a2` (the forwarder): `libkernel_sys.prx` imports `TJG6tf+yJlY` again, and the libkernel_sys-first executable spins until `timeout 15` kills it. `guest_sigqueue` still passes on that control, since it links the unpatched libraries. - `guest_sigqueue` 3/3. `guest_sigqueue`, `guest_kill`, `guest_signals`, `guest_signal_list`, `guest_signal_sets`, `guest_kernel_sys`, `patched_libraries` and `conventions_unknown_nids` pass, 8/8. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-11-14 10:49:56 +00:00 (Migrated from github.com)

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 the sigqueue helper context and the libkernel_sys build definition. No changed file was excluded.

Results

Check Result Note
Diff and changed lines passed All six changed files read
Tests not run Author reports Windows test results
Build not run No local build performed

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.cpp has 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5903927195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9389#pullrequestreview-5903927195). Originally posted by [MarcZX10](https://github.com/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 the `sigqueue` helper context and the `libkernel_sys` build definition. No changed file was excluded. ## Results | Check | Result | Note | |---|---|---| | Diff and changed lines | passed | All six changed files read | | Tests | not run | Author reports Windows test results | | Build | not run | No local build performed | ## 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.cpp` has 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9389
No description provided.