Skip to content

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

Closed

Description

@screamm

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 fix(libkernel): export execvp #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).

Activity

  1. blawesom commented on Oct 11, 2026

    @blawesom
    Contributor

    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.

  2. LeandroLP23 commented on Oct 13, 2026

    @LeandroLP23
    Contributor

    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)

  3. oneandonlydean commented on Oct 14, 2026

    @oneandonlydean
    Collaborator

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions