fix(module): resolve the default dlsym scope against the main program #864
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/864"
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 jeffrey12cali on 2026-10-06T10:32:57Z.
What
Titles pass handle 0 (
RTLD_DEFAULT) for a process-wide lookup, and the loader rejected it: the handle is not in the module map, so every such lookup failed even when a loaded module exports the symbol. Handle 0 and -2 now take the default scope - the global modules by plain name, NID and#guestform, then the process-wide scope.The process-wide scope of the real loader also contains glibc and libstdc++, so an unfiltered fallback would answer
malloc,dlopenandpthread_createwhere PS5 reports the symbol as missing. Handle 0 is the main program, whose lookup sees the program's exports and not the host C++ runtime (same model as KytyPS5'sFindProgramById(handle)->export_symbols). A result from the process scope is therefore accepted only whendladdrattributes it to a converted or replacement module - a.prxlibrary or the executable.The scripting heap from the previous revision of this branch is removed; see the reply to the review for the measurement that decided it.
Tested
Arch Linux, GCC,
Release,cmake -DBUILD_TESTING=ON:ctest392/392 passed on this head.guest_dynamic_loadernow asserts both directions of the change. Handle 0 must resolve a guest export (dlsym(0, "GuestModuleAdd")), and the host namesmalloc,dlopenandpthread_createmust stay null. Verified by reverting the feature itself, not a variant of it: withDynamicLoader.cpptaken frommain, the test fails (0% tests passed, 1 tests failed). With this branch's loader it passes.One gap is named rather than hidden.
GuestModuleAddis found by the module loop before the process-scope fallback runs, so no assertion exercisesDefaultScopeSymbolitself yet. That case needs a module that is in the process scope but absent from the loader's module map, which this fixture set does not provide.On a title (PPSA28997, native Linux relink): booting with the scripting heap removed reaches the same milestone as with it - managed bootstrap completes,
level0/level1open, no abort - which is why the export was dropped rather than documented.Checklist
main; no other open PR implements the same functions (checked #1156, #846, #1102 - none touchdlsymscope)One note on freshness: I could not rebase onto the current tip - pushing main's commits that touch
.github/workflows/conventions.ymlto my fork is refused because the OAuth token has noworkflowscope - so this head is based on931109b3. I will rebase as soon as the fork'smainis synced, and re-run the suite after.Refs #694.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T16:22:39Z.
Review: CHANGES_REQUESTED
Built and ran ctest merged onto current
main(Linux, all green);guest_dynamic_loaderfails without the change, good. A few things before this can go in:MainProgramModule()is::dlopen(nullptr, ...)(DynamicLoader.cpp:73), i.e. the whole process scope, andFindSymboltries the plain name before the NID. A probe inguest_dynamic_loader_testsgets non-null fordlsym(0, "pthread_create"),"dlopen"and"malloc": host glibc wins over the guest exports. This contradicts "nothing reaches for host glibc" in the description. On PS5, handle 0 is the main program and the lookup only searches its export table (KytyPS5KernelDlsym,FindProgramById(handle)->export_symbols). Handle 0 should only see guest exports (NID /#guestnames), not the host process scope.scriptingGetMem. prosper (docs/archive/ROADMAP_HISTORY.md, IL2CPP bring-up) madesceKernelDlsymreturn ESRCH forscriptingGetMem"instead of fake success, keeping the caller's fallback", and the title then finishesil2cpp_init. Only KytyPS5 special-cases the name. Since the name exists in none of the title's binaries, ESRCH looks like what real hardware does. If you have evidence that the export exists on PS5, please cite it. Otherwise the default-scope fix alone (with an honest not-found) may be enough. Please check whether your title still boots that way.GetModuleHandleW(nullptr)only covers the executable, whilescriptingGetMemlives in the libc DLL, so the new assertions inguest_dynamic_loader(also registered on Windows) look like they will fail there. CI hasn't run on this head yet.(alignment, bytes)signature is inferred, so it needs a line under "Unknown function info" indocs/dev/TechnicalDebt.md. The test should also check the requested alignment (& 0xFFF), not just 16 bytes (GuestDynamicLoader.cpp:55), and coverscriptingFreeMem.Imported from boykopovar/AnyPS5. Originally posted by jeffrey12cali on 2026-10-07T16:46:56Z.
Thank you for the careful review - the handle-0 finding is a real bug and the
scriptingGetMemchallenge is correct. I measured it before replying, and the answer changes what this PR should contain.scriptingGetMemis not needed. Removing it. I gated both exports out of the vendored libc (so the lookup fails honestly, as prosper'sdocs/archive/ROADMAP_HISTORY.mddescribes) and re-ran PPSA28997 with scripted input:level0,level1level0,level1So I have no evidence the export exists on PS5 and no evidence the title needs it - your reading is right and the fake allocator was my inference, not a measurement. I will rework this PR to be the default-scope fix only, with an honest not-found, and drop the scripting heap (kept locally as a patch in case a later symptom points at it). If it comes back at all it goes in with the
(alignment, bytes)signature recorded under "Unknown function info" and tests covering the alignment andscriptingFreeMem, as you said.Handle 0 reaching host symbols is a genuine defect and I will fix it, not document it. You are right that it contradicts my description, and the probe is decisive:
dlsym(0, "pthread_create"),"dlopen","malloc"returning non-null means the host process scope wins over guest exports.MainProgramModule()beingdlopen(nullptr)is exactly the wrong scope for PS5 semantics, where handle 0 is the main program's own export table (same model as KytyPS5'sFindProgramById(handle)->export_symbols). The fix I intend: for handle 0, resolve only against the main program's guest exports - the#guest/NID names - and never fall through to the host scope, so a plain name that only exists in glibc resolves to nothing rather than to glibc. I will add those three names toguest_dynamic_loader_testsas negative assertions so this cannot regress.Windows. Agreed, and I had not verified it:
GetModuleHandleW(nullptr)covers only the executable while the libc exports live in another module, so the new assertions should fail there. I will gate the assertions to the platform whose semantics they test, or make the Windows lookup cover the runtime modules as well - whichever the handle-0 model ends up being - and get CI green on the head before asking for another look.One question so I fix the right thing: for handle 0, should a name that exists both as a guest export and as a host symbol resolve to the guest (my reading of PS5 semantics), and should
RTLD_DEFAULT-style guest lookups ever see the host process scope at all, or only the guest link map list?Imported from boykopovar/AnyPS5. Originally posted by jeffrey12cali on 2026-10-07T17:38:54Z.
All four points accepted; the head is rewritten.
7f5eacc4, two files, +29/-1.Handle 0 no longer reaches host symbols. The default-scope fallback is now filtered by
dladdr: a process-scope result is accepted only when it comes from a converted or replacement module (a.prxlibrary or the executable).dlsym(0, "malloc"),"dlopen"and"pthread_create"are asserted null inguest_dynamic_loader. I checked that the assertion actually pins the behaviour rather than merely passing: replacing the filter with a bare::dlsym(RTLD_DEFAULT, ...)makesguest_dynamic_loaderfail, and restoring it makes it pass. YourFindProgramByIdframing is what I implemented, minus the per-program table, because on Linux the guest module list plus a filtered process scope is the same set.scriptingGetMemwas an inference, and it is gone. You were right to push on it. I gated both exports out so the lookup fails honestly and re-ran PPSA28997 with scripted input:level0,level1level0,level1So the default-scope fix stands on its own, the scripting heap is dropped from this PR, and no
TechnicalDebtline is needed for an inferred signature that no longer exists. I have the code parked locally if a later symptom ever points back at it, but prosper'sESRCHreading is now the one I have evidence for.Windows. The assertions and the process-scope fallback are both inside
#ifndef _WIN32now, so nothing on that platform depends onGetModuleHandleW(nullptr)covering the runtime modules. If the default scope should also exist on Windows, that is a separate question about the PE import model and I would rather raise it in its own PR than smuggle it in here.Comments. Removed - you were right that the description claimed there were none while the diff carried them. The head has no added comments.
CI. Not green on the head yet, and one blocker I cannot fix from my side: I cannot rebase onto current
mainbecause pushing main's commits that touch.github/workflows/conventions.ymlto my fork is refused (the OAuth token has noworkflowscope). This head is therefore based on931109b3; I will rebase once the fork'smainis synced and re-run the suite. If there is a preferred way to handle that for contributor forks, tell me and I will use it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T20:07:38Z.
Review: CHANGES_REQUESTED
Built and ran ctest merged onto current
main(Linux, 400/400 green). Three things left:DynamicLoader.cppchanges reverted,guest_dynamic_loaderstill passes: onmainhandle 0 is rejected outright, sodlsym(0, "malloc")etc. are already null (GuestDynamicLoader.cpp:92-94). Your "verified to bite" check swapped in a different broken version, notmain. The new behaviour, handle 0 finding an export, isn't asserted anywhere (handle -2 on a global module was already covered at line 40). Please add positive cases:dlsym(0, "GuestModuleAdd")on the RTLD_GLOBAL module from the test, and one export that is only reachable through the process-scope fallback (e.g. a.prxexport by NID).leaf == "app.elf"(DynamicLoader.cpp:59) depends on the file name. The output name is the user's choice (relinker input.elf output.elf;app.elfin USAGE.md is only an example), so a renamed executable has its exports silently rejected. Identify the main program by the object itself instead, e.g. compareinfo.dli_fbasewith the main executable's base (dladdron a symbol of the executable, or the firstdl_iterate_phdrentry).workflowscope (gh auth refresh -s workflow), or use "Sync fork" in the GitHub UI and rebase on that.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T21:51:32Z.
@adriadam10's first point — "the new behaviour, handle 0 finding an export, isn't asserted anywhere" — is a one-line addition next to the handle -2 check he notes is already covered (
GuestDynamicLoader.cpp:40):Nothing else changes.
Verified by reverting only
DynamicLoader.cpp, keeping the test (applied onto a rebase against currentmain, since no checks have run on this head):100% tests passed out of 1DynamicLoader.cppreverted1/1 Test #343: guest_dynamic_loader ..... Subprocess aborted—0% tests passedThe revert is confirmed to be a real one:
grep -c 'handle == nullptr' DynamicLoader.cppgoes from 2 to 0 before the rebuild. Onmain, handle 0 never enters the search at all, so the new assertion fails there and passes with the change — which is the property the first attempt was missing.Two honest limits.
guest_dynamic_loaderon Windows stands, and this line is subject to it.GuestModuleAddis found by the module loop beforeDefaultScopeSymbolis reached, so it exercises handle 0 being accepted, not the fallback itself. A genuine case needs a symbol the module scan misses; I could not construct one from this test's fixtures and would rather say so than add an assertion that passes for the wrong reason.The remaining points on the review — handle 0 reaching host symbols, the
leaf == "app.elf"file-name dependence, and thescriptingGetMemquestion — are unaffected by this and still need your call. This only removes the "test doesn't cover the fix" blocker.Happy to open a PR against
jeffrey12cali:fix/...with exactly this if that is easier than applying it by hand; otherwise the line above is the whole change and it is yours to use.Imported from boykopovar/AnyPS5. Originally posted by jeffrey12cali on 2026-10-08T00:42:31Z.
You were right, and my earlier "verified to bite" claim was wrong. I checked it your way this time. Head is
c3ffd7f1.What I did wrong. My check replaced the filter with a bare
::dlsym(RTLD_DEFAULT, ...). That tests a different broken build, notmain. Onmain, handle 0 never enters the search, so the three host-name assertions pass without any change. I have now confirmed that directly: I copiedDynamicLoader.cppfromupstream/main(grep -c 'handle == nullptr'returns 0), kept the test, rebuilt, andguest_dynamic_loaderpassed. The assertion did not pin the fix.What I added. The positive case @Dextroid17 proposed:
Verified in both directions on this head:
DynamicLoader.cppfrommain, new tests kept0% tests passed, 1 tests failed100% tests passed out of 1100% tests passed out of 392One limit I share with @Dextroid17.
GuestModuleAddis found by the module loop beforeDefaultScopeSymbolruns. So the new assertion proves handle 0 is accepted and resolves, but it does not prove the process-scope fallback works. I also could not build a case that reaches only the fallback from this test's fixtures. A real one needs a module that is in the process scope but not in the loader's module map, which the current fixture set does not give us. If you can point at a shape that does, I will add it. I would rather leave the gap named than add an assertion that passes for the wrong reason.The file-name dependency is gone.
leaf == "app.elf"was wrong, because the output name is the user's choice. The main program is now identified by its load base:dl_iterate_phdrrecords the entry with an emptydlpi_name, andFromGuestModulecomparesinfo.dli_fbaseagainst it..prxfiles are still accepted by suffix. I could not test the renamed-executable case, because the test binary exports no guest symbols. If you want that covered, a fixture executable with an export would do it, and I will add it.CI and rebase. I still cannot rebase onto current
main. Pushing a branch that carriesmain's commits for.github/workflows/conventions.ymlis refused, because my token has noworkflowscope. I did not trygh auth refresh -s workflow, because it needs an interactive browser authorisation from this session. Two options, and I will take whichever you prefer: you run "Sync fork" onjeffrey12cali/AnyPS5, and I rebase and re-run, or I authorise the extra scope locally and push. This head is based on931109b3.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T02:57:29Z.
Thanks — the corrected negative control is exactly the check that was missing, and the table is the shape I would want: loader from
mainwith the new tests kept,1 failed; this branch,100% passed. That is what separates a test that pins the fix from one that passes on both sides, and your description of why the earlier attempt tested a different broken build (::dlsym(RTLD_DEFAULT, …)never reachinghandle == nullptr) is the useful part of the record.Agreed on the limit, and I would leave it named rather than papered over.
GuestModuleAddresolving through the module loop beforeDefaultScopeSymbolruns is a real gap in what the assertion proves, and an assertion that passes for the wrong reason is worse than an acknowledged hole. The shape that would close it — a module present in the process scope but absent from the loader's module map — is not something this fixture set gives either of us, so I have nothing better to offer than the honest note.On the rebase blocker, the facts are on your side. GitHub refuses any push that modifies
.github/workflows/from a credential without theworkflowscope, and that check is on the credential, not the branch — there is no rebase-side workaround, which is why the two routes you listed are the only ones:gh auth refresh -s workflowgives your token the scope in this session, after which the rebase and push go through normally. It is interactive, as you say, but it is the route that unblocks you without anyone else.jeffrey12cali/AnyPS5frommainperforms the same update server-side, so your branch can then be rebased onto your ownmainwithout you ever pushing a workflow file.I have no preference between them and it is not mine to set — either gets the head onto current
main, and the choice belongs to the maintainer. What I would not do is drop the workflow file from the branch to work around it, since that is the file the conventions job runs from.Nothing else from me on the code. The load-base identification (
dlpi_nameempty, compared viadli_fbase) is a better anchor than the output file name, and I could not test the renamed-executable case either, for the same reason you give.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T05:24:43Z.
This seems to cover the
handle == 0part of #694, wheredlsym(NULL, name)returns nil. AddingRefs #694to the description would link them. TheDT_NEEDEDvisibility part of #694 is not mentioned in this PR.Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T05:46:35Z.
On the remaining gap, a test where only the process-scope fallback can resolve the symbol: the test executable itself can provide one.
DefaultScopeSymbolaccepts symbols whosedli_fbaseis the main program, and the main program isn't in the loader's module map (thedlopen(nullptr)handle is closed at line 37). So an export defined inGuestDynamicLoader.cppcan only be found through the fallback once the executable exports its symbols (ENABLE_EXPORTS, non-Windows only):Checked on Ubuntu 24.04, GCC 14.2, on top of
c3ffd7f1:guest_dynamic_loaderDynamicLoader.cppfrommain, test keptDefaultScopeSymbolcalls removed (handle 0 still accepted)The third row is the one that was missing: the test fails when only the fallback is removed. Full suite on this head plus the test: 392/392 passed.
tools/check_conventions.pypasses on the commit. Not tested on Windows; the case is#ifndef _WIN32like the fallback itself.Feel free to take it into this PR. AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T05:48:49Z.
Review: CHANGES_REQUESTED
Built and ran ctest merged onto current
main(413/413 green); withDynamicLoader.cppreverted,guest_dynamic_loadernow fails, so the handle-0 → guest export assertion pins the fix. Thanks for redoing that check.One thing left:
MainProgramBase,FromGuestModuleandDefaultScopeSymbol(DynamicLoader.cpp:54-84, call site:163-167) are only reached when the module loop finds nothing, and the three host-name asserts (GuestDynamicLoader.cpp:93-95) pass identically without that path, so the dladdr filter itself is unpinned. The existing fixture can cover it:::dlopenthe test guest.prxdirectly withRTLD_GLOBAL(so it is not in the loader's module map) and assertdlsym_nid_postfix(nullptr, "<its export>")returns it, and that a host symbol still returns null.info.dli_fbase == dlpi_addr(:75) only matches for PIE executables (non-PIE hasdlpi_addr == 0). Either compare against the executable's actual mapping start or note the PIE assumption in TechnicalDebt.Not verified on our side: the title run (PPSA28997).
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T06:13:12Z.
Following up with @adriadam10's suggestion (host
dlopenof the fixture withRTLD_GLOBAL). Writing it turned up a bug: the.prxbranch ofFromGuestModulenever matches.".prx"is 4 characters, so this compares the path's last 5 characters ("t.prx") with it, and the result is never 0. On this head the fallback therefore only returns symbols from the main program. Symbols fromDT_NEEDED-loaded.prxlibraries, the #694 case, are still rejected. I traced it insideDefaultScopeSymbol:::dlsym(RTLD_DEFAULT, "3qcG+yBRS+s")returns the export from/…/anyps5-host-loaded-module-for-test.prx, andFromGuestModulethen rejects it.Fix plus test (on top of
c3ffd7f1and my previous comment's test):The fixture is
libguest_module_fixture.so, so the test copies it to a.prxname, as the.guest.prxcase already does. It exportsGuestModuleAddonly as its NID, so the case also covers the NID retry.guest_dynamic_loader(Ubuntu 24.04, GCC 14.2):main.prxcheck returns falseRTLD_DEFAULTresult accepted)Full suite with the fix and both tests: 392/392 passed.
check_conventions.pypasses. Not tested on Windows; the new case is inside the existing#ifndef _WIN32block.I didn't address the PIE point (
dli_fbasevsdlpi_addrfor a non-PIE executable). Both test executables here are PIE.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T10:37:39Z.
Confirmed from the head, and the bug is exactly as you describe.
FromGuestModuleends withcompare(pos, count, s)comparescountcharacters of the substring against the NUL-terminated".prx"(4 characters), so the comparison can never return 0 for a 5-character slice like"t.prx"— the whole guard ispath.size() > 5 && false. On this head the.prxbranch therefore never matches andDefaultScopeSymbolonly ever returns main-program symbols; theDT_NEEDEDcase from #694 stays rejected, which matches your trace inside the function.path.ends_with(".prx")is the right fix, and your table (aborts when the.prxcheck returns false, passes with it) is the assertion the earlier threads were missing.That also closes the fallback gap I noted a few comments up — between your
GuestDefaultScopeOnlycase and this one, both halves ofDefaultScopeSymbolare now pinned.Same limitation on my side: this is from reading the head, not a rebuild (my box is NVIDIA-only), and I can't run the Windows path either. The case is inside the existing
#ifndef _WIN32block, so nothing there depends onGetModuleHandleW.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T10:48:25Z.
Review: CHANGES_REQUESTED
Built and ran ctest merged onto current
main(440/440 green); withDynamicLoader.cppreverted,guest_dynamic_loaderfails, so the handle-0 assertions pin the change. Two things left:.prxbranch ofFromGuestModulenever matches (DynamicLoader.cpp:77):path.compare(path.size() - 5, 5, ".prx")compares 5 characters against a 4-character string, so it is never 0. The fallback therefore only returns symbols from the main program, and symbols from.prxlibraries (the #694 case) are still rejected.path.ends_with(".prx")fixes it.DefaultScopeSymbolis reached only when the module loop finds nothing, and themalloc/dlopen/pthread_createasserts pass without it. hikazey posted two tests in this thread that cover it: an exported symbol in the test executable (ENABLE_EXPORTS, non-Windows) and a hostdlopen(..., RTLD_GLOBAL)of the fixture. Please add them (with the.prxfix, the second one fails without it) and check they fail with bothDefaultScopeSymbolcalls removed.Also add
Refs #694to the description, as fisherjoey suggested.Imported from boykopovar/AnyPS5. Originally posted by jeffrey12cali on 2026-10-08T11:55:42Z.
Both points are fixed, and I verified each control myself. Head is
5aa7a5b9, three files,+67/-1.The
.prxbranch was dead code, and you were both right.path.compare(path.size() - 5, 5, ".prx")compares five characters against a four-character string, so it can never return 0. I confirmed it in isolation before changing anything:FromGuestModulenow usespath.ends_with(".prx"). This was my regression: the earlier revision usedends_with, and my rewrite to identify the main program by load base replaced it with the brokencomparecall.Both tests are in, and I re-ran every control @hikazey asked for. I took @hikazey's two tests as posted - the
ENABLE_EXPORTSsymbol in the test executable, and the hostdlopen(RTLD_NOW | RTLD_GLOBAL)of the fixture - plus thelibkernelproperty change. On this head:guest_dynamic_loader100% tests passed out of 1.prxcheck reverted to thecompareform0% tests passed, 1 tests failedDefaultScopeSymbolcalls removed, handle 0 still accepted0% tests passed, 1 tests failedDynamicLoader.cppfrommain, tests kept0% tests passed, 1 tests failed100% tests passed out of 438The second row is the one that proves the
.prxfix is pinned, and the third proves the fallback is executed. So the gap I called unbuildable in my last comment is closed - @hikazey found the shape I was missing, and @Dextroid17 confirmed the bug independently from the head. Both are credited in the commit.Windows. I could not compile for Windows here: no MinGW toolchain on this machine. The two new assertions and the fallback itself are inside
#ifndef _WIN32, and theENABLE_EXPORTSproperty is set underif(NOT WIN32), so nothing new reaches that path. CI will have to confirm it.Refs #694is now in the description, as suggested.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-08T12:27:38Z.
Review: COMMENTED
Verified the design and the test's ordering assumptions against the source before commenting. Two things worth an answer, one small must-fix nit.
What I checked (all correct):
0x100-global fixture isdlclosed and thepinnedmodule was opened without0x100(soRTLD_LOCAL, invisible toRTLD_DEFAULT); the hostRTLD_GLOBALcopy is the only one the default scope can find, sodlsym(nullptr, "GuestModuleAdd") == hostAddis sound.ENABLE_EXPORTS ONon the test target is required forGuestDefaultScopeOnlyto be visible toRTLD_DEFAULT.MainProgramBase()viadl_iterate_phdr(emptydlpi_name= main program) is the right convention; static-local init is thread-safe.libc.so(malloc,dlopen,pthread_create) are correctly rejected byFromGuestModule.1. (question, design)
FromGuestModuleaccepts any default-visibility symbol in the main program. The relinked executable contains the whole AnyPS5 runtime, so a guestdlsym(NULL, ...)can now resolve a same-named runtime symbol that lives in the exe — the test only proves symbols fromlibc.soare filtered. Real hardwaredlsym(NULL)is also main-scope so this is probably fine, but it's the kind of resolution change that can silently differ from the console, so it would be good to state that this is intended.2. (parity gap)
DefaultScopeSymboltries the plain name and the NID, butFindSymbolalso triesname#guestandnid#guest. If aDT_NEEDED-loaded prx exports only#guest-suffixed symbols, a handle lookup finds them but the default scope cannot. Should the fallback mirror all four forms?3. (nit, must-fix) Formatting glitch in
GuestDynamicLoader.cpp— twoRequirestatements on one line:4. (nit) The hardcoded NID
"3qcG+yBRS+s"could beNid::ComputeNid("GuestModuleAdd", "")so it can't drift from the fixture.5. (forward-compat note)
link.h/dl_iterate_phdrdoesn't exist on macOS; the#ifndef _WIN32guard will need narrowing when the macOS port lands (that port ships adl_iterate_phdremulation). Fine for now.6. (scope note for #694) The issue's local fix also added the
scriptingGetMem/scriptingFreeMemexports, and the "intentionally omitted?" question is still open — the issue probably shouldn't be considered fully closed by this PR alone.Overall the approach (filter the real
RTLD_DEFAULTinstead of registering everylibs/*.prxin the modules map) looks right and less invasive than the alternative discussed in #694.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T12:34:14Z.
Review: APPROVED
Checked on Linux merged onto current
main: build + ctest 450/450 green; withDynamicLoader.cppreverted,guest_dynamic_loaderfails, so the handle-0 / default-scope assertions pin the change. The.prxfix (ends_with) and the two tests from @hikazey (executable export viaENABLE_EXPORTS, hostdlopenwithRTLD_GLOBAL) cover the fallback; thanks to @hikazey and @Dextroid17 for finding the dead branch.Added on top (rebased on
main):GuestDynamicLoader.cpp(pthread_createassertion /GuestDefaultScopeOnly).Not verified here: Windows runtime (everything new is under
#ifndef _WIN32; covered only by the Windows CI job). Merging once CI is green on the pushed head.