Repository navigation
fix(libkernel): fail kern.proc.pathname with ENOENT, as a PS5 does - #24481
oneandonlydean merged 1 commit into
Conversation
A payload process on a PS5 (firmware 11.60) got ENOENT from
{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid} for pid -1, its own pid,
pid 1 and 0x7fffffff, for a size query and for 1,024- and 1-byte
buffers, with the buffer and the length left alone, and EPERM for a
write (boykopovar#22788). ENOENT for a pid that does not exist puts the answer
before the pid lookup. The tree returned /app0/eboot.bin, following
FreeBSD's sysctl_kern_proc_pathname, and ESRCH for other pids. A MIB
without exactly one pid keeps EINVAL, which was not measured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against da869b00d5:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_system_configuration_testsbuilt cleanly. - CTest (
guest_system_configuration):1/1 Test #5837: guest_system_configuration ....... Passed 0.07 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libkernel/System/src/SystemConfiguration.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #5837: guest_system_configuration .......Subprocess aborted***Exception: 0.53 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified sysctl_nid_postfix kern.proc.pathname handling (nameLength == 4 && name[0] == 1 && name[1] == 14 && name[2] == 12) returns -1 with *__error_nid_postfix() = 2 (ENOENT) for all pid inputs without modifying oldValue or oldLength, consistent with hardware probe observations.
- Verified validation ordering in sysctl_nid_postfix: length bounds check (nameLength < 2 || nameLength > 24), GuestCopyIn_nid_no_patch for name, newValue check for EPERM (__error_nid_postfix() = 1) and nameLength != 4 check for EINVAL (__error_nid_postfix() = 22) are evaluated before returning ENOENT.
- Verified technical debt documentation: new fragment docs/dev/debt/changes/fix-libkernel-sysctl-proc-pathname-enoent.md correctly documents the ENOENT behavior and hardware probe source per AGENTS.md requirements.
- Verified test coverage in core/libs/tests/GuestSystemConfiguration.cpp: CheckPathnameSysctl and CheckNameToMib thoroughly test mibSelf, callerPid, scePthreadGetthreadid, foreign pid, absent pid (0x7fffffff), size query, buffer capacities, write rejection (EPERM), and length/buffer preservation.
- Verified compliance with AGENTS.md rules: no prohibited comments added, no hardcoded title workarounds, no extra unapproved files.
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change matches the stated ENOENT behavior for the pathname MIB, preserves validation and write handling, and the inspected code and reported checks support merging.
What I ran
Reviewed head da869b00d5339b5c9edd3ab3a126e100489688ea using the prepared diff.patch, manifest.json, and the pinned repository reader. No tests or build commands were run during this review.
Results
| Check | Result | Note |
|---|---|---|
| Changed-code review | passed | Three changed files read |
| Tests | not run | Reported results are author supplied |
| Full-text coverage | passed | All manifest files included and read |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not independently verify the PS5 firmware measurement, run the reported test suite, or test Windows/macOS or a title process. files.json was unavailable in the prepared review folder; the manifest lists three included files, and all three were read.
To get this to a good state
Nothing is required.
|
Reviewed All line numbers here are at the head The measurement matches the change. Lines 4 to 11 of the first probe output in #22788 show Non-blocking: the Runs.
On the merge, Negative control. I reverted the Mutations. Each runs once with the line-reporting
The test line numbers are in I did not run XPSemu (PPSA97358), so I have not checked the Host:
AI-assisted: yes |
224732c to
da869b0
Compare
|
@Helldiverr Agreed, the parenthetical is stale, but I left it as it is for now, because fixing it here would make this PR conflict with #22788.
|
|
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.
|
What
sysctl{CTL_KERN,KERN_PROC,KERN_PROC_PATHNAME, pid} returned/app0/eboot.binfor -1 and the calling process, following FreeBSD'ssysctl_kern_proc_pathname, andESRCHfor other pids. A payload process on a PS5 (firmware 11.60) gotENOENTin xXPBSXx's first probe in #22788 (lines 4 to 11 of its output) for pid -1, its own pid, pid 1 and 0x7fffffff, for a size query and for 1,024- and 1-byte buffers, with the buffer and the length left alone, andEPERMfor a write.ENOENTfor a pid that does not exist puts the answer before the pid lookup.ENOENTfor any pid and leaves the buffer and length alone. A write keepsEPERM, and a MIB without exactly one pid keepsEINVAL, which was not measured.qemu_init_exec_dirfalls back torealpath(argv[0])when thissysctlfails, as it must on the console. XPSemu was not run here.CheckPathnameSysctland thesysctlnametomibcheck inGuestSystemConfiguration.cpp.kern.proc.pathnameentry is replaced.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
da869b00d5, the single commit onmainc8f72e905c.main84e16538d4,guest_system_configurationaborts.da869b00d5,ctestoverguest_system_configuration,guest_kernel_sysctl_name_bounds,guest_kernel_sysctl_memory_nodes,guest_sce_netandguest_getrlimit: all pass.ctest(6393 tests,-j 12) on this branch and my other eleven branches of this round, merged ontomain84e16538d4: 6378 passed. The 15 failures also fail onmainin this environment:.gitdirectory, network access or a passwd entry for the user:conventions_git_errors,test_script_registration,web_library_assets,title_run,title_run_identity,guest_kernel_sys_login,guest_net_ctl,guest_getloginandguest_getlogin_no_session;agc_driverGPU cases fail the same way onmain:prepared_shaderswith itsindirect,uncachedanddebugforms, andstorage_file_write;agc_driver_image_table_packed_guardsis unstable onmainas well (2 of 10 runs passed on its own onmain3f4693be43).python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch fix/libkernel-sysctl-proc-pathname-enoent: no overlap with open pull requests.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)