feat(libkernel): handle sysctl queries for pathname, physmem and cacheline size #3779
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3779"
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 pushkarreddyy on 2026-10-11T16:40:06Z.
What
This pull request implements missing
sysctlandsysctlbynamehardware and process queries inlibkernel:kern.proc.pathname(MIB{1, 14, 12, pid}):/app0/eboot.binfor pid -1 and the calling process (getpid()), matching FreeBSD 11.4sys/kern/kern_proc.csysctl_kern_proc_pathnameand the sandbox filesystem layout.ESRCH(3) for any other pid.EINVAL(22) when invoked viasysctlbynameor when the MIB does not have exactly one pid argument (nameLength != 4).qemu_initqueries{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}).machdep.cacheline_size:ENOENT(2), matching FreeBSD amd64 where this powerpc-specific sysctl OID is not defined. Leaves the caller buffer untouched so XPSemu falls back cleanly to its built-in CPU cacheline default.mainonwhat(): sysctlbyname_nid_postfix: unsupported name machdep.cacheline_size).hw.physmem(name and MIB{6, 5}):sysconf(_SC_PHYS_PAGES) * 0x4000), matching FreeBSDkern_mib.c.oldValue.ENOMEM(12) for short buffers.EPERM(1) whennewValue != nullptron read-only sysctl variables.std::runtime_error.guest_system_configurationtesting length probes, exact buffer queries, short buffer rejections (ENOMEM), write rejections (EPERM), PID matching,ESRCHfor foreign pids,EINVALfor invalid MIB lengths, andmachdep.cacheline_sizeENOENT.Resolves #3722.
cc @adriadam10 @MarcZX100 @blawesom - kindly requesting expedited review and maintainer testing for XPSemu and PS5MC.
Tested
python tools/check_conventions.py --base origin/main(100% pass, zero errors).git diff --check.guest_system_configurationunit tests pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T16:41:54Z.
Implementation Details & Expedited Testing Request
Hi @adriadam10, @MarcZX100, @blawesom,
This PR addresses the startup crashes in XPSemu (PPSA97358) and PS5MC (PPSA99420) as reported in #3722:
kern.proc.pathname (MIB {1, 14, 12, pid}):
machdep.cacheline_size:
hw.physmem (MIB {6, 5} and by name):
Status & Verification:
Could you please run expedited maintainer testing for XPSemu and PS5MC with this PR? Thank you!
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:19:23Z.
Rebased on current main (only a TechnicalDebt adjacency conflict with the
execvline, no logic changes). Build and ctest green on the rebased tree (guest_system_configurationpasses and fails without the change), conventions green.kern.proc.pathnamefollows FreeBSDsysctl_kern_proc_pathname, and the unverified console path is recorded in TechnicalDebt. Merging.Notes: the design and wording match the fix branch @screamm posted in #3722 (
feat/libkernel-sysctl-names), so credit to them. #3700 touches the same function and will need a rebase after this one lands.