Commit Graph

3 Commits

Author SHA1 Message Date
MarcZX100 b6f96f8e90 test(libkernel): extend existing credential regression coverage 2026-10-11 18:55:56 +00:00
Mouad-Scriptz-0 bc5bfd0ed6 feat(libkernel): export setuid, setreuid, setgroups and getgroups
`setuid`, `setreuid` and `setgroups` are absent imports of XPSemu
(PPSA97358) and PS5MC (PPSA99420) on `main`. The guest process is modelled
as root with ids 0, as `seteuid` and `setegid` already assume: `setuid`
accepts 0 and `setreuid` 0 or -1 per id and change nothing, any other id
throws. `setgroups` keeps the supplementary group list as FreeBSD's
`kern_setgroups` does (`NGROUPS_MAX` 1023, an empty list leaves the
effective group as the only entry, a first entry other than 0 throws) and
the new `getgroups` reports it. `guest_credentials` covers the accepted
ids, the default list, a set list, an empty list and the EINVAL/EFAULT
cases.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit d12b062074dcf64bff694800d77f7261adf6f59e)
2026-10-11 18:55:22 +00:00
Daniel Radosa 1414b27d29 feat(libkernel): implement seteuid and setegid
The guest process is assumed to run as root. Under FreeBSD's
sys_seteuid and sys_setegid, id 0 is then accepted without a privilege
check and changes no credential, so both return 0. Any other id would
change the effective credential, which is not modelled, and throws.

Part of #1578.
2026-10-09 19:14:02 +02:00