Repository navigation
feat(libkernel): implement setresuid and setresgid - #9218
Merged
oneandonlydean merged 1 commit intoOct 22, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
Follow FreeBSD 11.4 sys_setresuid and sys_setresgid (sys/kern/kern_prot.c): accept real, effective, and saved user and group IDs for the guest process, which is assumed to run as root with IDs 0. Setting an ID to 0 or -1 (unchanged) is accepted without changing credentials and returns 0; any other value throws. Cover both in guest_credentials test and update libkernel debt documentation.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
harisibrar1
reviewed
Oct 22, 2026
harisibrar1
left a comment
Contributor
There was a problem hiding this comment.
Checked against main 6ef5a1c and FreeBSD 11.4 sys_setresuid/sys_setresgid (sys/kern/kern_prot.c):
- The behaviour is consistent with main's credential model. getuid and its siblings report 0, and setreuid/setregid already accept 0 or -1 and throw otherwise. For a root caller, FreeBSD treats -1 as unchanged and 0 as a no-op, so returning 0 there is correct, and throwing for any other id avoids faking a credential change.
- Blocking question: is either function actually exported on the PS5? Neither the PS5 SDK stubs (
sce_stubs/libkernel.c,libkernel_sys.c,libkernel_web.cat a7685ce8) nor the PS5-3.20libkernel.c/libkernel_sys.ctables listsetresuidorsetresgid, while all of them listsetreuidandsetregid. Main has no discovery stub for them either. As written,Process.cpp:773and:784add libkernel.prx NIDs that no title or SDK binary can import. - Could you cite a title import or firmware NID dump that has these exports, and name the library? If there isn't one, I think this PR should be dropped rather than add exports the console does not have.
- Builds on Windows (WinLibs GCC 15.2.0 r7, full
BUILD_TESTING=ONbuild) merged onto main 6ef5a1c; the only failing step is the existingImageArrayWindowPastLayerLimit.cppalignment error that #8310 fixes. Not run here: this machine's Smart App Control blocks freshly built test executables.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implement
setresuid_nid_postfixandsetresgid_nid_postfix(FreeBSD syscalls 311 and 312) incore/libs/prx/libkernel/System/src/Process.cpp, test them inGuestCredentials.cpp, and updatedocs/dev/debt/libkernel.md.Why
FreeBSD 11.4 provides
setresuidandsetresgid(sys/kern/kern_prot.c) to set the real, effective, and saved user and group IDs of the process.AnyPS5 models a guest environment running as root with real, effective, and saved IDs set to 0.
0xffffffffu, unchanged) is accepted without modifying credentials and returns 0.std::runtime_error.errnoleft untouched.Tested
Windows 11 x64:
core/libs/tests/GuestCredentials.cppwith unit test coverage:0xffffffffu) returning 0.errnois untouched on success.std::runtime_errorfor real, effective, and saved IDs across both user and group variants.python tools/check_conventions.py --base upstream/main --head HEAD.python tools/check_main_sync.py: HEAD is 1 ahead and 0 behind upstream/main, clean merge.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository