fix(libkernel): check getrlimit output pointers #8986
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8986"
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:40:33Z.
What
Check the guest output pointer in
getrlimitbefore writing through it. Results are built in local storage and copied to guest memory with the checked guest write helper, returning-1with guestEFAULTfor inaccessible addresses instead of faulting the emulator. Resource validation still precedes pointer validation, preserving the existingEINVALversusEFAULTprecedence.Regression coverage checks inaccessible output addresses for both a host-derived resource limit and the emulator-stored
RLIMIT_NOFILEvalue.Tested
cmake --build build --target guest_getrlimit_tests guest_setrlimit_tests -j2passed.git diff --checkpassed.ctest --test-dir build --output-on-failure -R '^guest_(getrlimit|setrlimit)$'could not reach assertions: both executables abort at AnyPS5's host CPU compatibility gate because this Xeon E5-1620 v2 lacks BMI1/BMI2, LZCNT, MOVBE, AVX2 and FMA.git grep; it was interrupted. The changed exports are existing functions, and the focused build passed.tools/pr_overlap.pyfound shared-file warnings for #8537 and macOS ports #8658/#7201. I reviewed those PRs: #8537 changessetrlimitsemantics and must precede this follow-up; the macOS PRs are platform-port changes, not duplicategetrlimitpointer handling.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T08:41:18Z.
Progress report (
27c88a8→29d50d1)📈 System libraries: 51.03% (+0.01%, +2 implemented functions)
✅ 2 implemented
getresgid_nid_postfixgetresuid_nid_postfixImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T09:45:49Z.
Windows data point for
29d50d189merged ontomain27c88a8d7(clean,git merge-treerc 0): Windows 10.0.19045, MinGW-w64 GCC 15.2.0, Release.ctest -N -R '^guest_getrlimit$'lists exactly that one test;ctest --no-tests=error -R '^guest_getrlimit$'was run three times per tree.core/libs/prx/libkernel/System/src/Process.cpprestored tomain(the new test cases kept): fails 3 of 3 with a segmentation fault (ctest reportsSEGFAULT).Not tested: other platforms, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T10:13:46Z.
Linux data point for
29d50d189e(the Windows run is in the comment above): WSL2 Ubuntu 24.04 (virtualised kernel, not bare-metal Linux), GCC 13.3.0, Release,BUILD_TESTING=ON, PR head alone (not merged ontomain; merge-basef894ba69d).ctest -R '^(guest_getrlimit|guest_credentials)$'passes 3 of 3 runs (both tests).core/libs/prx/libkernel/System/src/Process.cpprestored to the merge-base (new tests kept):guest_getrlimitfails (SegFault);guest_credentialsdoes not link (undefined reference to getresuid_nid_postfix).Not tested: macOS, a title run.
AI-assisted (Claude Code).