fix(libkernel): return EFAULT for invalid group pointers #8985
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8985"
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:32:55Z.
What
Handle guest pointer failures in
setgroupsandgetgroupswithout dereferencing guest addresses in the host process.setgroupsnow copies the requested IDs through checked guest-memory access before updating the stored list;getgroupscopies the list out through checked guest-memory access. Invalid guest memory returns-1with guestEFAULT.Adds regression cases for invalid input and output pointers to
GuestCredentials.cpp.Why
These credential calls currently read or write caller-provided pointers directly. An unmapped address can terminate the emulator instead of returning the guest error.
Tested
cmake --build build --target guest_credentials_tests -j2passed on Linux (GCC 12.2).python3 tools/check_conventions.py --base upstream/main --head HEADpassed.git diff --check upstream/main...HEADpassed.ctestexecutable was built but could not reach its assertions on this host: the existing libkernel startup CPU check rejects this Xeon because it lacks PS5-required BMI1/BMI2, LZCNT, MOVBE, AVX2, and FMA.Checklist
main; distinct from other group credential workThis branch is stacked on #8977 so it can share the checked guest-memory platform imports. The #8977 and #8894 commits in its history retain their original authors. The overlap checker also reports #8658 and #7201 because they edit
Process.cppfor separate macOS process argument and resource-usage support; those changes are unrelated, but merging any of those branches will require coordinating a rebase.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T08:33:43Z.
Progress report (
27c88a8→67db9d3)📈 System libraries: 51.03% (+0.01%, +2 implemented functions)
✅ 2 implemented
getresgid_nid_postfixgetresuid_nid_postfixImported from boykopovar/AnyPS5. Originally posted by clairtonmichel on 2026-10-21T08:52:30Z.
Tested on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (Fedora Linux, Mesa 26.2.5):
guest_named_shm_lifecycle,descriptor_reuse,permissions,io_descriptor_reuse, etc.) passed successfully (9/10 green).guest_named_shm_concurrencyfailed becauseunlinkof a read-only shared object did not returnEACCESas expected. Permission enforcement on unlinking read-only shm needs a quick check by the author.Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T13:05:44Z.
Windows run of
67db9d371fmerged ontomain27c88a8d75(3e8551ea12, clean), on a CPU the start-up check accepts, soguest_credentialsreaches its assertions. 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. The head carries #8977's commits; the negative control for those is on #8977. Not run: a negative control for91b2911ca1alone (reverting it, or picking the test commit onto #8977 without it, conflicts), Linux, a title.