fix(libkernel): accept signal() for every valid signal number #3394

Merged
LeandroLP23 merged 2 commits from upstream-pr/3394 into main 2026-10-11 09:56:52 +00:00
LeandroLP23 commented 2026-10-11 09:40:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-11T09:40:56Z.


Carrying @husseinkad's fix for #3076 (they can't open PRs yet). The change is theirs: 57f581c9 and 41be8fc9 cherry-picked onto main, authorship kept. Two conflicts, both resolved without changing their code: GuestSignals.cpp keeps main's new alarm checks next to theirs, and the two TechnicalDebt.md lines they reword are applied to main's current versions (main had merged the socket line into "read, write and vector I/O"), so no old line comes back.

What

signal() failed with EINVAL for every signal without a host equivalent (SIGPIPE, SIGHUP, SIGUSR1, ...), so signal(SIGPIPE, SIG_IGN) failed. It now accepts every number from 1 to 128 and records the disposition as sigaction does, with SIGKILL and SIGSTOP accepting only the default handler, as in FreeBSD's kern_sigaction. Only the six signals with host equivalents take effect on the host, as before; TechnicalDebt says so.

Tested

Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release: guest_signals passes 3/3 and fails with main's Signals.cpp; ctest -E agc_ 445/445; conventions pass. Merged onto main e608d402 (after #1431), the 9 signal tests (guest_signal*, raise, kill, sigaction) pass 3/3.

Fork CI (run): Windows and the three relinker jobs pass. Linux fails agc_driver_image_plane_address_on_line_implicit_lod and guest_kernel_stack_protect, the same two in all three runs of this batch (#3111, #3076 and #3097 fixes, unrelated changes), so they come from main. This run also had one agc_driver_depth_fast_clear_submit segfault on lavapipe, which the other two runs don't show.

Fixes #3076

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code, for carrying, the conflict resolution and the Windows run; see the issue for the author's disclosure)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818121354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3394). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-11T09:40:56Z. --- Carrying @husseinkad's fix for #3076 (they can't open PRs yet). The change is theirs: `57f581c9` and `41be8fc9` cherry-picked onto `main`, authorship kept. Two conflicts, both resolved without changing their code: `GuestSignals.cpp` keeps `main`'s new `alarm` checks next to theirs, and the two `TechnicalDebt.md` lines they reword are applied to `main`'s current versions (`main` had merged the socket line into "read, write and vector I/O"), so no old line comes back. ### What `signal()` failed with `EINVAL` for every signal without a host equivalent (`SIGPIPE`, `SIGHUP`, `SIGUSR1`, ...), so `signal(SIGPIPE, SIG_IGN)` failed. It now accepts every number from 1 to 128 and records the disposition as `sigaction` does, with `SIGKILL` and `SIGSTOP` accepting only the default handler, as in FreeBSD's `kern_sigaction`. Only the six signals with host equivalents take effect on the host, as before; TechnicalDebt says so. ### Tested Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release: `guest_signals` passes 3/3 and fails with `main`'s `Signals.cpp`; `ctest -E agc_` 445/445; conventions pass. Merged onto `main` e608d402 (after #1431), the 9 signal tests (`guest_signal*`, raise, kill, sigaction) pass 3/3. Fork CI ([run](https://github.com/LeandroLP23/AnyPS5/actions/runs/38126973670)): Windows and the three relinker jobs pass. Linux fails `agc_driver_image_plane_address_on_line_implicit_lod` and `guest_kernel_stack_protect`, the same two in all three runs of this batch (#3111, #3076 and #3097 fixes, unrelated changes), so they come from `main`. This run also had one `agc_driver_depth_fast_clear_submit` segfault on lavapipe, which the other two runs don't show. Fixes #3076 ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes (Claude Code, for carrying, the conflict resolution and the Windows run; see the issue for the author's disclosure)
adriadam10 commented 2026-10-11 09:56:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:56:49Z.


Checked on Linux merged onto current main: guest_signals passes and fails without the change; the 106 tests of libs and libkernel pass. signal() now matches sigaction() (1..128, SIGKILL/SIGSTOP only with the default handler) and TechnicalDebt reflects it; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107800269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3394#issuecomment-6107800269). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T09:56:49Z. --- Checked on Linux merged onto current main: `guest_signals` passes and fails without the change; the 106 tests of libs and libkernel pass. `signal()` now matches `sigaction()` (1..128, `SIGKILL`/`SIGSTOP` only with the default handler) and TechnicalDebt reflects it; merging.
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!3394
No description provided.