fix(libkernel): return EFAULT for invalid getresid pointers #8977
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8977"
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 MarcZX10 on 2026-10-21T08:12:46Z.
What
Validate each non-null
getresuidandgetresgidoutput pointer before writing the modeled root ID. Invalid or unwritable guest pointers now return-1with guestEFAULTinstead of crashing the host process.Adds regression cases for invalid pointers to
core/libs/tests/GuestCredentials.cpp.Why
PR #8894 adds these calls and currently writes through raw pointers. Since guest memory can contain invalid addresses, these writes need the same guest-address validation and protected host-write path used elsewhere.
Tested
Process.cppandGuestCredentials.cppon Linux.python3 tools/check_conventions.py --base upstream/main.git diff --check upstream/main...HEAD.SDL2Config.cmake) is unavailable in this environment.Checklist
main, with #8894 included as a dependencyImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T08:13:35Z.
Progress report (
f894ba6→30167da)📈 System libraries: 50.59% (+0.01%, +2 implemented functions)
✅ 2 implemented
getresgid_nid_postfixgetresuid_nid_postfixImported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T13:05:42Z.
Windows run of
30167dace1merged ontomain27c88a8d75(fbfbe1cbc8, clean), the executable test the description lists as blocked. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release,BUILD_TESTING=ON, Ryzen 9 7900.Built
libkernelandguest_credentials_testswith no errors or warnings;ctest --repeat until-fail:3onguest_credentials: passes all three repeats.Negative control on the same merge: with
afc7e26ce9(theProcess.cppchange) reverted and the test commit kept,guest_credentialsfails withSegFault,FATAL: unhandled exception 0xc0000005. So the new invalid-pointer cases fail without the fix and pass with it. Not run: Linux, a title.