libkernel: execv/execve and the setuid/setgroups/setrlimit family are absent (XPSemu, PS5MC); fix branch ready #3558

Closed
opened 2026-10-11 13:11:49 +00:00 by screamm · 3 comments
screamm commented 2026-10-11 13:11:49 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T13:11:49Z.


libkernel lacks execv (KaK52lYTBIs) and execve (kdguLiAheLI), and the identity and limit setters setuid (JVmUZwK-HJU), setreuid (6w8tPp+Yk6E), setregid (ROILLZdYZPc), setgroups (M8VZ3iIlmyg) and setrlimit (4X0QwvuCfjc). From the relink registry order execv/execve are the predicted next stop of XPSemu (PPSA97358) and the setters follow for XPSemu and PS5MC (PPSA99420); not yet observed in a run.

Fix branch ready: screamm:feat/libkernel-exec-setuid (two commits on main a11c8f7f: 57f0fa37 feat(libkernel): implement execv and execve as throwing exports, 1d0b2b61 feat(libkernel): implement the identity and limit setters). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are.

  • execv/execve follow the execvp precedent of #2827: FreeBSD's checks first (EFAULT for a null argv or path, ENOENT/ENOTDIR from the guest lookup, EACCES for a non-regular file), then the executable replacement not implemented throw where FreeBSD would load the image; over-long paths and oversized argument blocks throw rather than guess. XPSemu's execv sites run in a fork child and its fork returns ENOSYS, so like execvp they are not reached at start-up (ZiZc3/XPSemu 8eec07b4). Sources: FreeBSD 8c639945 kern_exec.c, exec.c.
  • Setters follow the repository's root identity model and FreeBSD kern_prot.c/kern_resource.c: ids 0 (or -1 unchanged) succeed, any other id throws (the console's credential rules are unmeasured); setgroups takes {0} or the empty set (EINVAL above 1024, EFAULT for a null list with a count) and marks issetugid as changed as FreeBSD does; setrlimit returns EFAULT/EINVAL as FreeBSD orders them, treats negatives as infinity, lowers a soft limit above the hard one to it, and succeeds only when the result equals what getrlimit reports (RLIMIT_DATA), otherwise throws because getrlimit stores nothing. Note for XPSemu: its os_setup_limits calls getrlimit(RLIMIT_NOFILE) first, which still throws on main, so that is its real next stop there.
  • guest_execvp, guest_credentials, guest_getrlimit gain the new cases.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: the three tests 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 533/536, the failures being the known windows_exceptions (#3411), guest_kernel_sys (#3510) and guest_filesystem (#3518); with main's Process.cpp all three extended tests fail; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5801363253 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3558). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T13:11:49Z. --- libkernel lacks `execv` (`KaK52lYTBIs`) and `execve` (`kdguLiAheLI`), and the identity and limit setters `setuid` (`JVmUZwK-HJU`), `setreuid` (`6w8tPp+Yk6E`), `setregid` (`ROILLZdYZPc`), `setgroups` (`M8VZ3iIlmyg`) and `setrlimit` (`4X0QwvuCfjc`). From the relink registry order `execv`/`execve` are the predicted next stop of XPSemu (PPSA97358) and the setters follow for XPSemu and PS5MC (PPSA99420); not yet observed in a run. **Fix branch ready:** [`screamm:feat/libkernel-exec-setuid`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-exec-setuid) (two commits on `main` `a11c8f7f`: `57f0fa37` `feat(libkernel): implement execv and execve as throwing exports`, `1d0b2b61` `feat(libkernel): implement the identity and limit setters`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. - `execv`/`execve` follow the `execvp` precedent of #2827: FreeBSD's checks first (`EFAULT` for a null argv or path, `ENOENT`/`ENOTDIR` from the guest lookup, `EACCES` for a non-regular file), then the `executable replacement not implemented` throw where FreeBSD would load the image; over-long paths and oversized argument blocks throw rather than guess. XPSemu's `execv` sites run in a `fork` child and its `fork` returns `ENOSYS`, so like `execvp` they are not reached at start-up (ZiZc3/XPSemu `8eec07b4`). Sources: FreeBSD `8c639945` `kern_exec.c`, `exec.c`. - Setters follow the repository's root identity model and FreeBSD `kern_prot.c`/`kern_resource.c`: ids 0 (or -1 unchanged) succeed, any other id throws (the console's credential rules are unmeasured); `setgroups` takes `{0}` or the empty set (`EINVAL` above 1024, `EFAULT` for a null list with a count) and marks `issetugid` as changed as FreeBSD does; `setrlimit` returns `EFAULT`/`EINVAL` as FreeBSD orders them, treats negatives as infinity, lowers a soft limit above the hard one to it, and succeeds only when the result equals what `getrlimit` reports (`RLIMIT_DATA`), otherwise throws because `getrlimit` stores nothing. Note for XPSemu: its `os_setup_limits` calls `getrlimit(RLIMIT_NOFILE)` first, which still throws on `main`, so that is its real next stop there. - `guest_execvp`, `guest_credentials`, `guest_getrlimit` gain the new cases. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: the three tests 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 533/536, the failures being the known `windows_exceptions` (#3411), `guest_kernel_sys` (#3510) and `guest_filesystem` (#3518); with `main`'s `Process.cpp` all three extended tests fail; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
blawesom commented 2026-10-11 14:01:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T14:01:59Z.


Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • The branch is already based on current main — no rebase needed, the commit (1d0b2b619) is unchanged.
  • tools/check_conventions.py --base origin/main and git diff --check pass.
  • The process and file-descriptor tests pass, including the new exec/setuid family cases.
  • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).

The branch is also mirrored at blawesom:verify/3558 for anyone carrying.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109819142 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3558#issuecomment-6109819142). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T14:01:59Z. --- Independent verification on **Linux** (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - The branch is already based on current `main` — no rebase needed, the commit (`1d0b2b619`) is unchanged. - `tools/check_conventions.py --base origin/main` and `git diff --check` pass. - The process and file-descriptor tests pass, including the new exec/setuid family cases. - Full suite: **832/832 passed** (all tests including the Vulkan suites on AMD RX 9070 XT / RADV). The branch is also mirrored at [`blawesom:verify/3558`](https://github.com/blawesom/AnyPS5/tree/verify/3558) for anyone carrying.
LeandroLP23 commented 2026-10-13 20:11:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T20:11:28Z.


Every export this issue lists is on main now (checked at dacd78525), so it can be closed:

All of them are in core/libs/prx/libkernel/System/src/Process.cpp.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154247320 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3558#issuecomment-6154247320). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T20:11:28Z. --- Every export this issue lists is on `main` now (checked at `dacd78525`), so it can be closed: - `execv`: #3544 - `execve`: #4105 - `setuid`, `setreuid`, `setgroups`: #3893 - `setregid`: #4595 - `setrlimit`: #3980 All of them are in `core/libs/prx/libkernel/System/src/Process.cpp`. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-14 00:09:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:09:13Z.


Closing: all seven are on main (#3544, #4105, #3893, #4595, #3980). If a title still stops on one of them, comment here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157876489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3558#issuecomment-6157876489). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:09:13Z. --- Closing: all seven are on main (#3544, #4105, #3893, #4595, #3980). If a title still stops on one of them, comment here.
Sign in to join this conversation.
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#3558
No description provided.