Skip to content

fix(libkernel): let raise and kill return 0 for ignored signals - #8467

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/raise-default-ignored-signals
Oct 20, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/raise-default-ignored-signals

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

raise_nid_postfix (and kill on the own process, which calls it) failed with EINVAL for a signal without a host equivalent and without a guest handler, also when the guest had set it to SIG_IGN. FreeBSD 11.4 defines SIGURG, SIGCONT, SIGCHLD, SIGIO, SIGWINCH and SIGINFO as ignored by default (sys/kern/kern_sig.c:205-240), so sending one succeeds, and tdsendsignal forgets such a signal at once, also when it is blocked (kern_sig.c:2178-2187), except SIGCONT, which stays pending while blocked. A signal set to SIG_IGN is forgotten the same way. All of these now return 0. Signals whose default action ends the process, such as SIGUSR1, are unchanged.

Fixes #8466

Overlap: the open signal PRs #3986, #6044 and #7201 rewrite large parts of Signals.cpp and conflict with this change (git merge-tree: 3, 26 and 25 conflicts); the PRs #8407, #8411 and #8414 are clean against it. Whichever lands second rebases. pr_overlap was not run.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on upstream/main 44e3389 + this commit:

  • guest_signals: Exit code 0xc0000409 with System/src/Signals.cpp taken back to main (new test lines kept), passes with the change (3 of 3 runs). New cases: raise and kill(getpid(), ...) return 0 for 16, 19, 20, 23, 28 and 29 with errno untouched and no handler called; with those signals blocked, 16, 20, 23, 28 and 29 are not pending afterwards; signal 30 set to SIG_IGN returns 0 from raise and kill, also blocked, without becoming pending.
  • guest_sigtimedwait, guest_itimer, guest_itimer_pending_default, guest_kill, guest_signal_sets, guest_sigaltstack, guest_getitimer pass.
  • python tools/check_conventions.py --base upstream/main: passes.
  • Not tested: Linux (shared code, not built there), a console, a title run, pthread_kill to another thread (it still remembers such a signal as pending). No title is known to send these signals to itself.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3986 core/libs/prx/libkernel/System/src/Signals.cpp
core/libs/tests/GuestSignals.cpp
PR 6044 core/libs/tests/GuestSignals.cpp
PR 7201 core/libs/prx/libkernel/System/src/Signals.cpp

A signal that is ignored is forgotten when it is sent: the call succeeds
(sys/kern/kern_sig.c:2178-2187). That covers SIG_IGN and the signals whose
default action is SA_IGNORE, SIGURG, SIGCONT, SIGCHLD, SIGIO, SIGWINCH and
SIGINFO (kern_sig.c:205-240); SIGCONT stays pending while blocked. The guest
failed with EINVAL for every such signal that has no host equivalent.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx
xXPBSXx force-pushed the fix/raise-default-ignored-signals branch from f674de4 to 12ec674 Compare October 20, 2026 13:35
@xXPBSXx xXPBSXx changed the title fix(libkernel): let raise and kill return 0 for signals whose default action is to ignore fix(libkernel): let raise and kill return 0 for ignored signals Oct 20, 2026
@github-actions github-actions Bot added fix error Closes an issue (Fixes #N) libkernel labels Oct 20, 2026
@oneandonlydean
oneandonlydean merged commit 78e398d into boykopovar:main Oct 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix error Closes an issue (Fixes #N) libkernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libkernel: raise and kill on the own process fail with EINVAL for signals whose default action is to ignore

2 participants