feat(libkernel): implement seteuid and setegid #1748
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1748"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by danielradosa on 2026-10-08T18:24:22Z.
What
Part of #1578. Implements
seteuid(HTxb6gmexa0) andsetegid(4oKwKmeOKjM) in libkernel. In the #1578 audit,seteuidis an absent import of 11 of the relinking homebrew titles (ProsperoRadio, ProsperoLight, ProsperoTV, PS5MC, Prospero Win and others) andsetegidof 4. No open PR implements them or any otherset*idfunction.The guest process is assumed to run as root, with real, effective and saved ids 0; #1650 reports the same identity through
getuid/geteuid/getgid/getegid. In FreeBSD 11.0sys_seteuidandsys_setegid(sys/kern/kern_prot.c), an id equal to the real or saved id passes without a privilege check, and the credential changes (andP_SUGIDis set) only when the id differs from the current effective one. So:seteuid(0)andsetegid(0)return 0, change nothing and leave errno untouched.The known callers are the sandbox-elevation clients these homebrew share (the ps5-native-app-boilerplate example vendored in ProsperoLight, ProsperoTV and ProsperoStore; Porpoise; prospero-win; PSXS5). They call
seteuid(geteuid()), andsetegid(getgid())only whengetegid() != getgid(). With a root identity, both pass id 0. The assumed identity is recorded inTechnicalDebt.md.There is no build dependency on #1650: the two change different lines and merge in either order. If #1650's identity changes, the accepted id here follows it. Whichever lands second can fold the two
TechnicalDebt.mdentries into one and move these exports next to the getters.Title
Callers do
seteuid(geteuid())and imports resolve in name order, so onmainthese titles stop atgeteuidfirst; with #1650 they stop here. Runs posted by others:mainf1451396+ #1650: PPSA99003 ProsperoTV 01.000.030 stops atundefined symbol: HTxb6gmexa0(seteuid), PPSA99002 ProsperoLight 01.000.090 at4oKwKmeOKjM(setegid).mainf1451396with each stop's PR merged in turn: PPSA99808 PICO-8 v0.1.2 resolvesseteuidwith this PR and stops next atsigaction.main0fdda7be+ #1650: PPSA99003 ProsperoTV stops atHTxb6gmexa0and PPSA99002 ProsperoLight at4oKwKmeOKjM; with this PR they stop next atJGfTMBOdUJo(sceKernelGetFsSandboxRandomWord) and+F7C-hdk7+E(sigemptyset). Details in the comments.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, Ninja, full build with
BUILD_TESTING=ON, onmain0fdda7be(rebased today).guest_credentialstest:seteuid(0)andsetegid(0)return 0 and leave errno untouched; ids 1000 and 0xFFFFFFFF throw. Onmainthe test does not link, because the exports are missing.libkernel.prxexports both NIDs.ctest -R "^guest_": 161 pass, 0 fail, 1 skipped by design (guest_video_out_wqhd_detection_no_vulkan).tools/check_test_registration.pyandtools/check_conventions.py --base origin/mainpass.guest_address_tests, clear of #1859, which registers its test where this one first did. The branch merges cleanly with #1650 and #1859.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T22:20:16Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel/CMakeLists.txtL380Imported from boykopovar/AnyPS5. Originally posted by danielradosa on 2026-10-09T17:25:55Z.
Rebased onto
main0fdda7beand moved theguest_credentialsregistration beforeguest_address_tests, so it no longer collides with #1859. The description now lists the title runs posted on #1650 and #1578. Could a collaborator dispatch Actions > Build for this PR? Itspull_requestruns areaction_required.Imported from boykopovar/AnyPS5. Originally posted by danielradosa on 2026-10-09T18:28:54Z.
Windows runs of the two catalog titles, each relinked with
relinker --windowsfrom the release ZIP (sha256 as in the catalog record,eboot.binandsce_module/libc.prxunwrapped from their SELF containers). Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.main0fdda7be+ #1650main0fdda7be+ #1650 + this PRFAIL: unresolved ELF import HTxb6gmexa0 from libkernel.prx(seteuid)FAIL: unresolved ELF import JGfTMBOdUJo from libkernel.prx(sceKernelGetFsSandboxRandomWord)FAIL: unresolved ELF import 4oKwKmeOKjM from libkernel.prx(setegid)FAIL: unresolved ELF import +F7C-hdk7+E from libkernel.prx(sigemptyset)Both titles get past
seteuid/setegidwith this PR and stop at the next absent import.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:23:31Z.
Checked on top of current main: build + full ctest,
guest_credentialspasses and does not link without the change;libkernel.prxexportsHTxb6gmexa0and4oKwKmeOKjM. Behaviour matches FreeBSD 11.0sys_seteuid/sys_setegid(id equal to the real/saved id needs no privilege check) for the assumed root identity, and the assumption is in TechnicalDebt. Title runs by @LeandroLP23 and @CouchRiv on #1578/#1650 confirm the imports now resolve. Merging.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T21:31:59Z.
Progress report (
f8c2f07→1414b27)📈 System libraries: 84.7% (+0.01%, +2 implemented functions)
✅ 2 implemented
setegid_nid_postfixseteuid_nid_postfix