fix(libkernel): resolve original .prx names to relinked .guest.prx in lstat #9478
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9478"
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 EagleBearerYS on 2026-10-21T23:01:05Z.
What
#4688 made
stat,sceKernelStat, read-onlysceKernelOpenandsceKernelCheckReachabilityfindX.guest.prxwhen a title asks forX, the name the relinker replaced, and listedlstatas not covered.lstatstill answersENOENTfor the same path, so code that checks for a plugin withlstatsees it missing whilestatanddlopenfind it.lstatnow resolves the path with the module lookup ofResolvePathError_nid_no_patch, whichsceKernelStatalso uses. An existingX, including a dangling symbolic link, is still reported as it is; only a missingXfalls back toX.guest.prx. Since #5401 was opened,mainmoved that lookup fromFile::PathOrRelinkedModuleinto the resolver'smoduleflag, so the change is now that flag.No title is claimed.
Overlap: #7447 changes the same
ResolvePathError_nid_no_patchcall inlstat: it sets the resolver'sarchivedflag and answers fromFile::FillArchivedStatfirst, where this PR sets itsmoduleflag. The two should compose asResolvePathError_nid_no_patch(path, native, true, true), the callsceKernelCheckReachabilitymakes onmain. This PR proposed going first in #7447's thread (comment), with #7447 taking that call when it rebases. qpavyros agreed (comment): this PR first, and #7447 keeps both flags inlstat's call when it takes this PR in.#9618 (xXPBSXx) reworks the same function:
lstatfills a localFileStatand copies it out withGuestCopyOut_nid_no_patch, so it answersEFAULTwhen the output struct isn't writable guest memory. The two conflict only there, and compose as #9618's version of the function with this PR'smoduleflag in itsResolvePathError_nid_no_patchcall. xXPBSXx checked both orders and either works for #9618 (comment). #9618 goes first, merge order only, and this PR re-applies its one-line flag when it mergesmainafter it.The other PRs the overlap check lists don't touch
lstator its test, so the merge order doesn't matter for them:Stdio.cpp, and none of them changeslstat. Merged with this PR on top ofmain, none of their conflicts is on thelstatline; the ones they have are withmainitself.core/libs/tests/GuestFilesystem.cpptocore/libs/tests/files/GuestFilesystem.cppwithout changing it. Whichever of the two merges second carries this PR's twolstatchecks inTestRelinkedModuleNamesto the moved file.Related: #4225
Tested
On GitHub's runners from my fork, merged with
mainata6dcea9279(run), on both Linux and Windows:TestRelinkedModuleNamesinguest_filesystemgains twolstatchecks:ENOENTwhile neither name exists, and the relinked file's size onceX.guest.prxexists. Withmain'sStdio.cppthe test aborts on both. With the change it passes 10 runs in a row.core/libs/prx/libcandcore/libs/prx/libkernelpasses: 115 and 197 on Linux, 142 and 207 on Windows.mainatda54c652e3(82bd36d74b, no conflicts, the PR's own diff unchanged; run):guest_filesystemfails withmain'sStdio.cppon both runners and passes 10 runs in a row with the change. The libc and libkernel suites pass on Windows (143, 207) and libkernel on Linux (197); in libc on Linux, the timing testprecise_waitfailed once.mainatb91a6a60c5(20ae347f6a; run): #9618 now haslstatfill a localFileStatand copy it out to the guest, in the lines this PR changes. The merge keeps that and this PR's module lookup in the sameResolvePathError_nid_no_patchcall, so the PR's own lines are unchanged.guest_filesystemfails withmain'sStdio.cppon both runners and passes 10 runs in a row with the change. Linux: 1 run, 1 pass, 0 skip, 0 fail. Windows: 1 run, 1 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.tools/check_conventions.py --base origin/mainpasses.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 MarcZX10 on 2026-10-21T23:04:09Z.
This change overlaps
lstat_nid_postfixin #9423: that PR updates itsPathErrorcall to copy and validate the guest path, while this PR changes the same function’sResolvePathError_nid_no_patchcall. Please coordinate the order with #9423’s author and setDepends onif one needs to land first; after composition, keep both the checked path copy and relinked-module lookup.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T23:27:01Z.
Thanks, @MarcZX10.
git merge-treeof this PR's head (6e9768f618) with #9423's (4d7b47abe7) is clean. The mergedlstat_nid_postfixkeeps both: #9423 replacespathwith its checked copy right afterPathError, andResolvePathError_nid_no_patch(path, native, true)then runs on that copy. Neither needs the other first, so this stays at Depends on: none, and whichever merges second needs no change. @AliZedan1A, for your awareness.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T03:41:30Z.
Review: CHANGES_REQUESTED
The
module=truechange is technically consistent with the existing resolver:ResolvePathOrRelinkedModule_nid_no_patchhandles the module fallback, while ordinarylstatstill uses the non-module resolution path. The added missing-name and relinked-file size assertions cover the intended behavior, and the existingsceKernelCheckReachabilitycall demonstrates how the module and archived flags compose.The remaining blocker is merge coordination with #7447. Both PRs change this exact
lstat_nid_postfixresolver call. Your description proposes this PR first, followed by #7447 updating the call to(path, native, true, true), but #7447's author has not confirmed that order, and this PR still saysDepends on: none. Please agree the order with @qpavyros and record the dependency/order on the checklist. The overlap scan also reports shared paths with #5021, #6044, #6879, #6936 and #7201; please account for the relevant file/test changes before approval.The current eligibility, conventions, intake, labels and report checks pass. The Linux and Windows product jobs are skipped. The focused Linux and Windows runs in the description are author-reported; I did not run them locally.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T03:51:15Z.
Thanks, @MarcZX10. The Overlap section now covers each PR the check lists. #5021, #6879, #6936 and #7201 change other parts of
Stdio.cpp, notlstat, and none of their conflicts is on thelstatline. #6044 movesGuestFilesystem.cppunchanged, so whichever merges second carries the twolstatchecks to the moved file. For #7447 the order is proposed in its thread, and I'll record it under Depends on once qpavyros answers.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:30:35Z.
Review: DISMISSED
The module fallback is correctly limited to a missing original
.prxpath, while an existing file or dangling symlink remains handled bylstatitself; the regression covers missing and relinked names. The earlier #9423 checked-path overlap was manually confirmed to compose. The remaining functional coordination is #7447: it changes the same resolver call to setarchived, while this PR setsmodule; the combined call needs both flags, but #7447’s author has not confirmed the proposed order and this checklist still saysDepends on: none. Please agree the order with @qpavyros and record it, then preserve both flags when rebasing. This branch and reported tests are based ona6dcea9279, while current upstream main isab347d144d; rebase and rerunguest_filesystem, conventions and overlap on current main. Hosted product jobs are skipped; I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T06:00:36Z.
Thanks, @MarcZX10. The branch now has
mainatda54c652e3merged in (82bd36d74b), with the PR's own diff unchanged. On GitHub's runners (run)guest_filesystempasses 10 runs in a row on both and fails withmain'sStdio.cpp; the libc and libkernel suites pass apart from libc'sprecise_waittiming test once on Linux, and conventions pass. Tested now says so. The order with #7447 still waits on qpavyros; it goes under Depends on once they answer, and both resolver flags stay in the combined call.