libkernel: setuid, setreuid and setgroups are absent imports of XPSemu and PS5MC; fix branch ready #3862

Closed
opened 2026-10-11 18:07:06 +00:00 by Mouad-Scriptz-0 · 2 comments
Mouad-Scriptz-0 commented 2026-10-11 18:07:06 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-11T18:07:06Z.


libkernel exports getuid, geteuid, getgid, getegid, seteuid and setegid but not the POSIX credential setters setuid (JVmUZwK-HJU), setreuid (6w8tPp+Yk6E) and setgroups (M8VZ3iIlmyg), nor getgroups (3yjZbSvan2g), named with tools/nid_names.py against aerolib. An import audit of the homebrew catalog on main a11c8f7f (Linux, .prx built from main) lists them as absent imports of two titles:

Title Absent imports on main With this branch Removed
PPSA97358 XPSemu Alpha-2.1 34 32 setuid, setgroups
PPSA99420 PS5MC 1.2 (Kodi 22) 28 25 setuid, setreuid, setgroups

Their other absent imports are covered by open pull requests (#3494, #3580, #3568, #3606, #3787, #3781, #3694 and others), so these three were the ones left with no branch. No open PR adds them (tools/pr_overlap.py --branch reports no overlap; the open PR titles were also searched for the four names).

Fix branch ready: Mouad-Scriptz-0:feat/libkernel-credential-setters (d12b0620, one commit on main a11c8f7f). #3738 is my one open pull request, so I cannot open this as a PR until it is decided; anyone eligible is welcome to carry it, keeping the commit as is.

  • The functions follow the model seteuid/setegid already use in Process.cpp and TechnicalDebt (the guest process runs as root with real, effective and saved ids 0): setuid(0) returns 0 like FreeBSD's sys_setuid for an id equal to the current ones, setreuid accepts 0 or -1 (unchanged) per id, and any other id would change a credential, which is not modelled, and throws.
  • setgroups(count, groups) keeps the supplementary group list as kern_setgroups does: EINVAL above NGROUPS_MAX (1023) or below 0, EFAULT for a null list with a count, an empty list leaves the effective group as the only entry, and a first entry other than 0 would change the effective group (FreeBSD keeps it in cr_groups[0]) and throws. getgroups(capacity, groups) reports the list as sys_getgroups does: the count for capacity 0, EINVAL for a smaller capacity, EFAULT for a null list.
  • guest_credentials (new) covers the accepted ids, the default list (the effective group 0), a set list read back through getgroups, an empty list, and the EINVAL/EFAULT cases of both functions. The TechnicalDebt entry for seteuid/setegid now names the four functions and the group list.

Tested on Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON): guest_credentials, guest_truncate and guest_pthread_attr pass; tools/check_conventions.py --base origin/main and git diff --check pass. Table method: catalog release ZIPs checked against their sha256, eboot.bin and bundled modules unwrapped from their SELF containers, relinker --registry, tools/import_audit.py against .prx files built from main and from the branch. The titles were not run. Not tested on Windows.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5803734596 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3862). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-11T18:07:06Z. --- libkernel exports `getuid`, `geteuid`, `getgid`, `getegid`, `seteuid` and `setegid` but not the POSIX credential setters `setuid` (`JVmUZwK-HJU`), `setreuid` (`6w8tPp+Yk6E`) and `setgroups` (`M8VZ3iIlmyg`), nor `getgroups` (`3yjZbSvan2g`), named with `tools/nid_names.py` against aerolib. An import audit of the homebrew catalog on `main` a11c8f7f (Linux, `.prx` built from `main`) lists them as absent imports of two titles: | Title | Absent imports on `main` | With this branch | Removed | |---|---|---|---| | PPSA97358 XPSemu Alpha-2.1 | 34 | 32 | `setuid`, `setgroups` | | PPSA99420 PS5MC 1.2 (Kodi 22) | 28 | 25 | `setuid`, `setreuid`, `setgroups` | Their other absent imports are covered by open pull requests (#3494, #3580, #3568, #3606, #3787, #3781, #3694 and others), so these three were the ones left with no branch. No open PR adds them (`tools/pr_overlap.py --branch` reports no overlap; the open PR titles were also searched for the four names). **Fix branch ready:** [`Mouad-Scriptz-0:feat/libkernel-credential-setters`](https://github.com/Mouad-Scriptz-0/AnyPS5/tree/feat/libkernel-credential-setters) (`d12b0620`, one commit on `main` a11c8f7f). #3738 is my one open pull request, so I cannot open this as a PR until it is decided; anyone eligible is welcome to carry it, keeping the commit as is. - The functions follow the model `seteuid`/`setegid` already use in `Process.cpp` and TechnicalDebt (the guest process runs as root with real, effective and saved ids 0): `setuid(0)` returns 0 like FreeBSD's `sys_setuid` for an id equal to the current ones, `setreuid` accepts 0 or -1 (unchanged) per id, and any other id would change a credential, which is not modelled, and throws. - `setgroups(count, groups)` keeps the supplementary group list as `kern_setgroups` does: `EINVAL` above `NGROUPS_MAX` (1023) or below 0, `EFAULT` for a null list with a count, an empty list leaves the effective group as the only entry, and a first entry other than 0 would change the effective group (FreeBSD keeps it in `cr_groups[0]`) and throws. `getgroups(capacity, groups)` reports the list as `sys_getgroups` does: the count for capacity 0, `EINVAL` for a smaller capacity, `EFAULT` for a null list. - `guest_credentials` (new) covers the accepted ids, the default list (the effective group 0), a set list read back through `getgroups`, an empty list, and the `EINVAL`/`EFAULT` cases of both functions. The TechnicalDebt entry for `seteuid`/`setegid` now names the four functions and the group list. **Tested** on Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`): `guest_credentials`, `guest_truncate` and `guest_pthread_attr` pass; `tools/check_conventions.py --base origin/main` and `git diff --check` pass. Table method: catalog release ZIPs checked against their sha256, `eboot.bin` and bundled modules unwrapped from their SELF containers, `relinker --registry`, `tools/import_audit.py` against `.prx` files built from `main` and from the branch. The titles were not run. Not tested on Windows. AI-assisted: yes (Claude Code).
jagrat04 commented 2026-10-12 15:28:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-12T15:28:59Z.


This was resolved and merged into main via PR #3893 (commit d12b06207 / bc5bfd0ed). This issue can be closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127357221 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3862#issuecomment-6127357221). Originally posted by [jagrat04](https://github.com/jagrat04) on 2026-10-12T15:28:59Z. --- This was resolved and merged into `main` via PR #3893 (commit d12b06207 / bc5bfd0ed). This issue can be closed.
Mouad-Scriptz-0 commented 2026-10-12 16:15:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T16:15:11Z.


Confirmed: setuid, setreuid and setgroups are on main through #3893 (MarcZX100). The fix branch in the title is superseded; closing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128131046 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3862#issuecomment-6128131046). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-12T16:15:11Z. --- Confirmed: setuid, setreuid and setgroups are on main through #3893 (MarcZX100). The fix branch in the title is superseded; closing.
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#3862
No description provided.