Skip to content

feat(libkernel): implement kill - #2543

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
overlordxrz-source:feat/libkernel-kill
Oct 10, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
overlordxrz-source:feat/libkernel-kill

Conversation

@overlordxrz-source

Copy link
Copy Markdown
Contributor

What

kill (W0xkN0+ZkCE, libkernel) is missing on main. ProsperoStore (PPSA99000, the homebrew store) stops at it on current main.

The call is in the store's crash reporter (crash_report.cpp). It puts the crash signal back to SIG_DFL and sends it again with kill(getpid(), signal). The import has to resolve before the title can start. The call itself only runs from an SA_SIGINFO crash handler, and main does not deliver those yet.

kill follows FreeBSD's kern_kill and killpg1 (kern_sig.c). The guest is the only guest process:

  • A signal outside 0 to 128 returns EINVAL. This is checked first, as kern_kill does.
  • Signal 0 checks that the target exists and sends nothing.
  • The caller's own pid, 0 (its process group) and minus its own pid go to the caller through the existing raise. So they run signal/sigaction handlers, honour SIG_IGN and the sigprocmask mask, and have the same limits as raise.
  • -1 returns ESRCH, because FreeBSD's broadcast skips the caller and there is no other process. Any other pid also returns ESRCH.

EPERM is never returned, since there is no other process that could refuse permission. The guest is also assumed to lead its own process group. Both points are in TechnicalDebt next to sigaction.

Log

Linux rig (x86-64 Ubuntu, lavapipe, Release), homebrew catalog run of 2026-10-09: ProsperoStore PPSA99000 stops at the unresolved libkernel import W0xkN0+ZkCE (kill). W0xkN0+ZkCE is the NID of kill (SHA-1 NID computed with tools/nid_names.py, and it matches zecoxao's aerolib.csv). Nothing else on main or in an open PR exports it. The closed #2383 only declared it as NotImplemented.

With this PR applied, PPSA99000 moves past kill, next stop = ./app.elf: symbol lookup error: ./app.elf: undefined symbol: Mv1zUObHvXI.

Tested

aarch64 Debian host. The full project can't be built here because it needs x86-64.

  • New core/libs/tests/GuestKill.cpp (guest_kill, registered for Linux and Windows like guest_signals):
    • signal 0 succeeds for the own pid, 0 and minus the own pid, and a handler is not called;
    • another pid, -1 and another process group return ESRCH for signal 0 and for SIGTERM, and nothing is delivered;
    • -1 and 129 return EINVAL, even for a pid that does not exist;
    • SIGTERM reaches a signal handler through each of the three self targets;
    • SIG_IGN is honoured;
    • an undeliverable signal (100) reports raise's EINVAL.
  • I ran the test natively against Signals.cpp (Zig 0.17 clang) and it passes. The existing GuestSignals.cpp still passes against the changed file too. Four mutants each fail the test: wrong errno for a missing pid, signal 0 delivering, pid 0 not treated as self, and negative signals accepted.
  • Signals.cpp and the test compile for x86_64-linux-gnu and x86_64-windows-gnu with -Wall -Wextra. The only warning is the existing -Wreturn-type-c-linkage from General.hpp. Both also link into an x86_64 Linux executable and a MinGW .exe. Neither was run here.
  • python3 tools/check_conventions.py passes.
  • Not run with the title.

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

@github-actions github-actions Bot added the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

@github-actions github-actions Bot closed this Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Progress report (3d1a7d9 → 9a70477)

➖ System libraries: 85.75% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel kill_nid_postfix

@oneandonlydean oneandonlydean removed the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 10, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed labels Oct 10, 2026
ProsperoStore (PPSA99000) imports kill from libkernel and stops at it on
current main. Its crash reporter resets a crash signal to SIG_DFL and
sends it again with kill(getpid(), signal).

kill follows FreeBSD's kern_kill and killpg1 for the only guest process:
EINVAL for signals outside 0 to 128, signal 0 only checks the target,
and the caller's own pid, 0 and minus its pid deliver through raise.
Any other pid, and -1, which skips the caller, report ESRCH.
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main (only conflict: the TechnicalDebt line, moved next to sigaction instead of the end of the file). kill matches FreeBSD's kern_kill/killpg1 for the single guest process; guest_kill and the signal tests pass on Linux after the rebase. Merging once CI is green.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 10, 2026
@adriadam10
adriadam10 merged commit 3afc784 into boykopovar:main Oct 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants