Skip to content

feat(libkernel): add execve as a throwing export - #4105

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
MarcZX10:codex/carry-execv-execve-3558
Oct 13, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
MarcZX10:codex/carry-execv-execve-3558

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the missing execve export as an explicit unsupported-operation throw, matching execvp while process-image replacement is not modeled. This removes the unverified argument and path checks and does not change execv.

guest_execvp retains its execvp checks and verifies that execve throws. The debt entry records that console behavior for argument and path errors is unknown. No title unblock is claimed.

Tested

Linux x86-64, GCC 12.2.0, CMake/Ninja Release:

  • Built guest_execvp_tests.
  • CTest guest_execvp passed (1/1).
  • tools/check_conventions.py --base upstream/main passed.
  • Test-registration checks passed (18/18), and git diff --check passed.
  • Open-PR overlap scan found no other implementation of execve; the only matching export was this PR.

Not tested on Windows, a console, or a title.

Checklist

  • Based on current main; no other open PR implements the same function
  • 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 investigation notes or images added to the repository
  • No third-party code added
  • Generic behavior, not title-specific
  • Depends on: none
  • Unblocks: none confirmed
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Progress report (a252fcd → cdf4b17)

📉 System libraries: 87.98% (-0.02%, +1 declared functions)

🆕 1 declared as stubs
Library Name
libkernel execve_nid_postfix

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Local Linux validation is complete: GCC 12.2.0 Release/Ninja built guest_execvp_tests, and CTest guest_execvp passed 1/1. The conventions check and git diff --check also pass on current main. GitHub eligibility and intake checks pass; the remaining CI jobs are pending.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Does PPSA97358 stop on the execve import on main? #3558 calls it a predicted stop, not one seen in a run; please quote the line. If it does, a throwing execve like execvp on main is enough: no title reaches the checks in executableError (its fork returns ENOSYS), so please drop them and leave execv as it is.

@MarcZX10
MarcZX10 force-pushed the codex/carry-execv-execve-3558 branch 2 times, most recently from 970d177 to 62a769b Compare October 12, 2026 18:36
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed labels Oct 12, 2026
@MarcZX10
MarcZX10 force-pushed the codex/carry-execv-execve-3558 branch from 62a769b to 6f50566 Compare October 12, 2026 18:48
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Windows test of head 6f50566f4 merged onto current main (fa0cc752a, clean merge; built together with four other open PRs, so the run is for the combination): Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build 0 errors, -j2.

guest_execvp (the test this PR changes) passes. The seven tests of the five PRs (guest_coredump_user_data, guest_np_web_api2, guest_execvp, guest_math, guest_wide_conversion, guest_wide_strings, guest_character) all pass.

Not checked: that the test fails without the change, Linux, a title run.

AI-assisted (Claude Code).

@MarcZX10

Copy link
Copy Markdown
Contributor Author

I cannot confirm that PPSA97358 stops at execve: #3558 records a predicted stop, and I do not have a current-main run or the requested unresolved-import log line. The Windows report above covers the guest_execvp test, not a title run. I therefore cannot claim this PR unblocks PPSA97358; I have not changed the PR on that unsupported assumption.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the carry. Dean's request from 2026-10-12 is still open, and the extra logic has no evidence behind it:

  • executableError (core/libs/prx/libkernel/System/src/Process.cpp:172-187) adds EFAULT/ENOENT/ENOTDIR/EACCES, PATH_MAX and ARG_MAX handling. No title reaches it: the execv callers cited run in a fork child, and fork returns ENOSYS. Please drop it.
  • Leave execv as it is on main and make execve a plain throwing export like execvp (NotImplemented_nid_no_patch("execve: executable replacement")), with guest_execvp covering only that throw.
  • If you can quote the unresolved execve import for PPSA97358 (loader log or import table), add it to the PR body. #3558 only predicts it, so the body should not say this unblocks the title.
  • Update the docs/dev/debt/libkernel.md line to match the smaller change.

Happy to re-review once pushed.

@MarcZX10
MarcZX10 force-pushed the codex/carry-execv-execve-3558 branch from 6f50566 to c73a09d Compare October 13, 2026 11:30
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Implemented the requested narrowing in c73a09d58, rebased on current main (5d50886ee). The PR now adds only the execve throwing export; it removes the execv change and the unverified argument/path checks. guest_execvp retains the existing execvp checks and verifies the execve throw. I also removed the unsupported title-unblock claim and updated the debt entry.

On Linux x86-64 with GCC 12.2.0, guest_execvp_tests builds and CTest guest_execvp passes (1/1). Conventions, test registration (18/18), and whitespace checks pass. No Windows, console, or title run was performed.

@MarcZX10 MarcZX10 changed the title feat(libkernel): implement execv and execve as throwing exports feat(libkernel): add execve as a throwing export Oct 13, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor Author

@adriadam10 I pushed the requested narrowing and updated the regression, debt entry, and PR description. The Linux guest_execvp test, conventions, test registration, and diff checks pass on the current head. When convenient, please re-review.

David and others added 3 commits October 13, 2026 15:19
XPSemu PPSA97358 imports both from libkernel.prx; with the imports ahead
of them covered, its predicted next stops (relink registry order, not an
observed run) are:

  FAIL: unresolved ELF import KaK52lYTBIs from libkernel.prx  (execv, 7 call sites)
  FAIL: unresolved ELF import kdguLiAheLI from libkernel.prx  (execve, 4 call sites)

Today the title stops earlier at the observed
  FAIL: unresolved ELF import aRo9AhFUXcM from libkernel.prx  (sigsetjmp, merged in boykopovar#3486)

As for execvp (boykopovar#2827), the process image cannot be replaced here, so both
throw with the execvp message pattern once FreeBSD 11's execve would start
loading the image (freebsd-src 8c639945, sys/kern/kern_exec.c
exec_copyin_args, do_execve, exec_check_permissions; lib/libc/gen/exec.c
execv passes environ). Before that they fail as FreeBSD does: EFAULT for a
null argument vector or path, ENOENT and ENOTDIR from the lookup as stat
reports it, EACCES for a path that is not a regular file. Paths of
PATH_MAX bytes or more and strings over ARG_MAX throw instead of guessing
the console's limits. The execv calls in XPSemu's sources run in a fork
child (net/tap.c), and its fork fails with ENOSYS (ZiZc3/XPSemu 8eec07b4,
ps5/compat/libc_missing.c, ps5/build-title.sh --defsym).

NIDs computed with tools/nid_names.py and confirmed in aerolib.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 57f0fa3)
The rename to execve dropped execv, which PPSA97358 imports.

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the codex/carry-execv-execve-3558 branch from c73a09d to cdf4b17 Compare October 13, 2026 13:21

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for narrowing it. One thing was off: the diff renamed execv_nid_postfix to execve_nid_postfix, so execv was removed from main (and its debt line), although the description says it is unchanged. I added these as commits on your branch:

  • restored the throwing execv export in Process.cpp and its line in docs/dev/debt/libkernel.md;
  • guest_execvp now also checks that execv throws;
  • rebased on current main.

Built and ran the libkernel/libs ctest scope on the merged tree (146 tests, green; guest_execvp passes). Merging once the full Build is green.

@p3n1cillin

Copy link
Copy Markdown

Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on main 3faa9cb40 merged with this PR and the other open PRs that the catalog titles need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm's chroot branch from #3632); every title converted from its catalog release, eboot.bin kept in app0, 60 s runs.

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants