Repository navigation
fix(libkernel): resolve original .prx names to relinked .guest.prx in lstat - #9478
Conversation
… lstat boykopovar#4688 made stat, sceKernelStat, read-only open and sceKernelCheckReachability find X.guest.prx when a title asks for X, the name the relinker replaced. lstat still answered ENOENT for the same path, so a title that stats a plugin with lstat saw it missing while stat and dlopen found it. lstat now resolves the name the same way; an existing X, including a dangling symlink, is still reported as is.
|
This change overlaps |
|
Thanks, @MarcZX10. |
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
The module=true change is technically consistent with the existing resolver: ResolvePathOrRelinkedModule_nid_no_patch handles the module fallback, while ordinary lstat still uses the non-module resolution path. The added missing-name and relinked-file size assertions cover the intended behavior, and the existing sceKernelCheckReachability call demonstrates how the module and archived flags compose.
The remaining blocker is merge coordination with #7447. Both PRs change this exact lstat_nid_postfix resolver 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 says Depends 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.
|
Thanks, @MarcZX10. The Overlap section now covers each PR the check lists. #5021, #6879, #6936 and #7201 change other parts of |
MarcZX10
left a comment
There was a problem hiding this comment.
The module fallback is correctly limited to a missing original .prx path, while an existing file or dangling symlink remains handled by lstat itself; 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 set archived, while this PR sets module; the combined call needs both flags, but #7447’s author has not confirmed the proposed order and this checklist still says Depends on: none. Please agree the order with @qpavyros and record it, then preserve both flags when rebasing. This branch and reported tests are based on a6dcea9, while current upstream main is ab347d1; rebase and rerun guest_filesystem, conventions and overlap on current main. Hosted product jobs are skipped; I did not run local tests.
|
Thanks, @MarcZX10. The branch now has |
Main's boykopovar#9618 has lstat fill a local FileStat and copy it out to the guest. The merge keeps that and this branch's module lookup in the same call, so an original .prx name still resolves to its relinked .guest.prx.
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the |
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
mainat a6dcea9 (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.mainat da54c65 (82bd36d, 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.mainat b91a6a6 (20ae347; run): fix(libkernel): fail the stat family with EFAULT when the output struct is not writable guest memory #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)