fix(libkernel): return ENOENT for thirteen sysctl names, as measured on a PS5 #7541
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7541"
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 ionut27001 on 2026-10-18T12:58:14Z.
What
sysctlbynamenow answers thirteen names the way the console answers a payload process on a PS5 (firmware 12.70), where it threwunsupported name.sysctldoes the same for seven of their MIBs, andsysctlnametomibfor nine of the names; the other four names still throw insysctlnametomib.mainbefore this PRsysctlbynameforhw.byteorder,hw.cacheline_size,hw.machine_arch,hw.usermem,kern.clockrate,kern.maxfiles,kern.maxfilesperproc,kern.maxproc,kern.ps_strings,kern.sched.name,kern.smp.maxcpus,kern.stackprot,kern.timecounter.hardwareENOENT, buffer and length untouched. Same for a read, a size query, a null length, and a null buffer with a null lengthsysctlfor {1, 6}, {1, 7}, {1, 12}, {1, 27}, {1, 32}, {6, 4}, {6, 11}sysctlnametomibfor the seven names with those MIBserrnois kept (measured forkern.maxproc,kern.ps_strings,hw.byteorder); a short count copies part of the MIB and returnsENOMEM(measured forkern.maxproc,hw.byteorder)sysctlnametomibforhw.cacheline_size,hw.usermemENOENT, count and the first three MIB words untouchedmachdep.cacheline_sizeENOENTWrites: a write to the new names and MIBs throws. The probes never write a sysctl, so the console's answer to a write is not known.
machdep.cacheline_sizekeeps returningENOENTfor a write, as onmain.Changes in
docs/dev/debt/libkernel.md:machdep.cacheline_sizeentry now covers all fourteen names. It lists what is still not modelled: four of the names, whose MIBs the console numbers just below 2^31 (2147482814 to 2147483182), and all other names, which still throw.hw.realmemandvm.overcommitentries said the console's values were not known. They now say that a payload process on a PS5 (firmware 12.70) getsENOENTforhw.physmem,hw.realmemandvm.overcommit, and for {6, 5} and {6, 12}.dolphin_libretrocore, PS5MC PPSA99420 through mimalloc), so changing them is left for a separate PR.How the console was measured
resolvelines show that itssysctlbyname,sysctlandsysctlnametomibare the oneslibkernel_sys.sprxexports; p10 and p13 resolve some of them the same way, and p24 prints no resolve lines. All probes link these functions the same way.0xAA(p16, p24). Lengths were preset to 64 for a read and 77 for a size query (p16); p24 passes null lengths. MIB arrays were prefilled with0xAAbytes (p13, p16, p24).last_changedis one past the last byte that changed.Console output (excerpt, lines copied unchanged)
The
pNN:prefix names the probe; the rest of each line is copied unchanged.The other names and MIBs give the same lines. All of them are in the logs.
Overlaps:
GuestSystemConfiguration.cpp, so whichever lands second only has to change the path when rebasing.main6e27fc8f0conflicted with it inSystemConfiguration.cpp, where itsSystemStringsloop sat at the same place insysctlbyname_nid_postfix; the resolution keeps both blocks, #6220's loop first (the names do not overlap).sysconfdebt line next to thehw.realmemline; whichever lands second keeps both edits.sysctlbyname_nid_postfix,GuestSystemConfiguration.cppand the debt line abovesysconf. The two merge cleanly in either order.ENOENTfromsysctlfor the four MIBs this PR's debt entry lists as still throwing, and #7554 addskern.rng_pseudotosysctlnametomib; both editSystemConfiguration.cppat the same places as this PR, so whichever lands second keeps both blocks. After #7556, the debt clause "heresysctlnametomibandsysctlthrow for them" becomes "heresysctlnametomibthrows for them".kern.proc.vmmap) has landed. The rebase ontomain1e774a3b22conflicted with it inSystemConfiguration.cppand in the debt file, where its entries sit next to this PR's blocks; the resolution keeps both, #7070's first.Tested
Build: Windows 11 x86-64, full build with WinLibs MinGW-w64 GCC 15.2.0 (posix-seh, ucrt, r7) and
-DBUILD_TESTING=ON.Rebase (not re-tested): after #6833 landed, this branch was rebased onto
mainbbb45463c. The only conflict was indocs/dev/debt/libkernel.md, where #6833 changed thesysconfline next to this PR'shw.realmemandvm.overcommitlines; the resolution keeps #6833'ssysconfline and this PR's two lines. The code and test changes are the same as before the rebase, and the tests above were not run again on the new base.Tests: with this branch on top of
main9f25d0bf5b,guest_system_configurationand the otherguest_*tests pass: 464 of 465 pass andguest_video_out_wqhd_detection_no_vulkanis skipped on this machine. In the parallel run (ctest -j 6),guest_video_out_wqhd_detection,guest_pthread_rwlockandguest_pthread_second_jointimed out once and passed when rerun. The branch was then rebased ontomain5bf2e139efwithout conflicts, since upstream changed none of its code or test files, andguest_system_configurationpasses there too.Old code, new test: with
SystemConfiguration.cppreverted tomainand the new test kept,guest_system_configurationaborts.Rebase onto
main6e27fc8f0: after #6220 landed, the branch was rebased ontomain6e27fc8f0, resolving theSystemConfiguration.cppconflict with #6220 described under Overlaps; the other files merged without conflicts. With this branch and #7543's branch built in one tree on thatmain, theguest_*tests pass: 473 of 474, andguest_video_out_wqhd_detection_no_vulkanis skipped on this machine. That is the second of two full runs; the first, right after the build, timed out in four tests this PR does not touch (guest_message_destructor_unshared-decoy,guest_video_out_cursor,guest_app_info,guest_pthread_rwlock).guest_system_configurationalso passed 3 runs in a row. WithSystemConfiguration.cppreverted to thatmainand the new test kept,guest_system_configurationaborts withsysctlbyname_nid_postfix: unsupported name hw.byteorder. The branch merges cleanly withmain3259e4c3e.Console: behaviour measured on a PS5 (firmware 12.70), as described above.
Not tested here: Linux (a reviewer reported a Linux run in the comments), and no title.
Checklist
Based on current
main; no other open PR implements the same functionsOne topic per PR; follow-ups go in a new PR
No comments in code except technical debt
Unimplemented paths throw (
NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt fileNo notes, investigation
.mdfiles or images added to the repository (attach them to this PR)New third-party code is a submodule built from source
Generic behaviour, not specific to one title
Rebase: rebased onto
main1e774a3b22. #7070 has landed since the last rebase (kern.proc.vmmap), so the rebase conflicted inSystemConfiguration.cpp, where itsGuestVmEntriesblock and this PR'sIsUnansweredMibandIsUnansweredNameblocks sit at the same place; the resolution keeps both, #7070's first. It also conflicted indocs/dev/debt/libkernel.md, where #7070'skern.proc.vmmapentry and this PR'ssysctl names a PS5 payload process gets ENOENT forentry sit together; both are kept, andmachdep.cacheline_sizestays folded into this PR's entry as before the rebase. The code and test changes are otherwise the same as before the rebase. Re-tested on the new base: full build with WinLibs GCC 15.2.0 (Windows 11), exit 0;guest_system_configurationpassed twice (1.29 s, 0.06 s); withSystemConfiguration.cpprestored frommainthe test aborts withsysctlbyname_nid_postfix: unsupported name hw.byteorder.Depends on: none
Fixes: none
Unblocks: none
GPUs tested: n/a
AI-assisted: yes
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:33:25Z.
I'm preparing a separate PR for measured kern.rng_pseudo MIB {1,50} support and its sysctlnametomib mapping. The overlap checker flags nearby insertion points in SystemConfiguration.cpp and GuestSystemConfiguration.cpp; the behavior is separate, but rebasing may need small conflict resolutions. Which PR should land first, or are you comfortable with this one landing first?
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T13:36:49Z.
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.
docs/dev/debt/libkernel.mddocs/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.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:50:40Z.
I opened #7556 for the four additional numeric MIBs in your probe logs: it returns
ENOENTon the measuredsysctlread and size-query paths, while leaving writes unmodeled. It is separate from your name-to-MIB work;pr_overlap.pyreports no overlapping hunks. The PR body links back to your measurement as its evidence.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:54:07Z.
Update: the separate
kern.rng_pseudoPR is now open as #7554. It is behaviorally independent of the name-to-MIB cases in this PR; only adjacent insertion points may need conflict resolution during rebase. Either PR can land first, and I will keep the changes separate.Imported from boykopovar/AnyPS5. Originally posted by ionut27001 on 2026-10-18T14:37:52Z.
Thanks for picking these up. Either order is fine with me; whichever lands second resolves the conflict in
SystemConfiguration.cpp(both blocks stay). One text dependency: thesysctl names a PS5 payload process gets ENOENT fordebt entry here ends with "heresysctlnametomibandsysctlthrow for them" for those four MIBs. After #7556 onlysysctlnametomibthrows, so that clause should become "heresysctlnametomibthrows for them". If this PR lands first, could you adjust it in #7556? If #7556 lands first, I'll update it here. I checked the four MIBs in #7556 against the p16 log and they match.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T18:06:21Z.
Windows run. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON. Build:mainc3591adf9with #7623, #7612, #7611, #7603, #7579, #7563 and #7541 merged together (each merge clean, built once).guest_system_configuration,guest_pthread_rwlock,guest_pthread_second_joinandguest_video_out_wqhd_detectionpass 3 runs of 3.guest_video_out_wqhd_detection_no_vulkanskips itself on this host. No title was run.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T00:01:12Z.
Review: COMMENTED
Linux run, since the description and the existing run are Windows only.
Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON, full build.Head
3fac97bf6merged ontomain84c1a4d9a(clean merge).guest_system_configurationpasses.GuestSystemConfiguration.cpponly, onmain: aborts withsysctlbyname_nid_postfix: unsupported name hw.byteorder, so the test covers the new names.ctest -E "^agc|gpu|vulkan|video_out"): 739/739, same asmain.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T16:18:37Z.
Rebased onto current
main(conflicts inSystemConfiguration.cppwith #7556 and #7554: kept both blocks,kern.rng_pseudostays in thesysctlnametomibtable). Updated the debt entry as you proposed, since #7556 now answerssysctlfor the four MIBs: "heresysctlnametomibthrows for them". Rest of the review unchanged (probe logs, check order, new test aborts onmain); merged.