fix(libkernel): support kern.rng_pseudo MIB access #7554
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7554"
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-18T13:35:06Z.
What
Add the measured
kern.rng_pseudonumeric MIB{1, 50}tosysctland map the name throughsysctlnametomib. The PS5 firmware 12.70 payload probe output and sources attached to #7542 show that this numeric path matches the name-based call: a size query reports 64 bytes, reads return up to 64 bytes, a short buffer or a non-null buffer without a length returnsENOMEM, and a null buffer with a null length succeeds. Successful reads preserveerrno.Writes through this MIB were not measured, so they throw. The current generic leaf-MIB handling returns
ENOTDIRfor a trailing component after{1, 50}. The PS5 response to that longer MIB was not measured, so this is not claimed as console behavior.The overlap checker reports nearby insertions in #6220, #7070 and #7541, plus the
kern.rng_pseudodebt line changed in #7542. These PRs implement separate behavior; I asked their authors to coordinate merge order in comments. This change does not depend on their code.Tested
Linux:
g++ -std=c++20 -fsyntax-onlypassed forSystemConfiguration.cppandGuestSystemConfiguration.cpp. A smoke harness compiled and ran the changed implementation, covering name-to-MIB mapping, size query, a 64-byte read, short buffer/ENOMEM, null pointer cases,errnopreservation and the trailing-component error.Not run: the full project build and
guest_system_configurationCTest. CMake configuration could not complete in the fresh worktree because the SDL2 submodule is not initialized and this host lacks SDL's XRandR development support.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 (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:06:56Z.
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/System/src/SystemConfiguration.cppL389-390Some 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.
docs/dev/debt/libkernel.mdcore/libs/tests/GuestSystemConfiguration.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T14:41:49Z.
Thanks for checking the evidence scope. I updated the description to say the trailing-component
ENOTDIRis the current generic leaf-MIB behavior, not a PS5-measured result; the probe only covered the exact{1, 50}MIB. The implementation and smoke test scope are unchanged.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T20:25:26Z.
Rebased onto current
main(d17f456eac). The conflict was the new{1,50}handler versus the newerIsLeafMibhandling; the rebased code keeps the 64-bytekern.rng_pseudoread and preservesENOTDIRfor a descendant MIB.Validation on head
bb1f502653:{1,50}size query, short-bufferENOMEM,sysctlnametomibmapping, descendantENOTDIR, and rejection of unverified writes: passed.g++ -std=c++20 -fsyntax-onlyforSystemConfiguration.cpp: passed.git diff --checkandtools/check_conventions.py --base upstream/main: passed.guest_system_configurationCTest not run: full CMake configuration is blocked by missing SDL2/XRandR development dependencies in this environment.The rebased commit retains the existing MarcZX100 author identity. Hosted PR checks have not appeared yet.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T20:39:23Z.
Review: COMMENTED
Reviewed head
bb1f50265. One problem in the new test: one check fails at random.core/libs/tests/GuestSystemConfiguration.cpp:399:shortBuffer[62]is the last byte copied fromstd::random_device, so it equals0xaawith probability 1/256. When it does,guest_system_configurationaborts. The implementation is correct in that case.I checked it with a standalone copy of the new
{1, 50}handler andCopyOut, plus this check, built with Apple clang on arm64 (M2 Max, macOS 27.2). It failed 3995 times in 1,000,000 runs (0.40%, against 1/256 = 0.39%).The test only needs to show that bytes were copied into the first 63 positions, so something like this would do:
The other random checks in
CheckPseudoRandomMibSysctl(changedover 64 bytes, and thememcmpof two reads) fail with probability around 256^-64. Those are fine.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T15:51:56Z.
Fixed on rebased head
7e7ba5836c. The short-buffer test now scans all 63 copied bytes for a value differing from the0xaasentinel and still checks the byte at index 63 remains untouched, avoiding the prior 1-in-256 false failure. Rebased onto currentmain(d047690c63) without conflicts; the original implementation commit remains authored by MarcZX100, and the test follow-up is authored by MarcZX10.g++ -std=c++20 -fsyntax-only -Icore/libs core/libs/tests/GuestSystemConfiguration.cpp, the conventions checker, andgit diff --checkpass. I could not run the full CMake target here: SDL2 lacks its CMake source and XRandR development support is unavailable. Hosted checks for the updated head are pending.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T11:07:31Z.
Rebased onto current
main: the only conflict was thekern.rng_pseudoentry indocs/dev/debt/libkernel.mdafter #7542. I kept main's text and updated its last sentence, sincesysctlnametomibandsysctl{1, 50} no longer throw (a write through the MIB still does). The code is unchanged. Re-checked the{1, 50}handler, thesysctlnametomibmapping, the leaf entry and the test; the libkernel tests pass on the rebased head; merged.