fix(kernel): retain module registry through process teardown #5572
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5572"
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 JJenkx on 2026-10-14T00:10:30Z.
What
The dynamic loader's static module map destroys owned modules with dlclose during process exit. Guest finalizers can reenter module lookup while that map is partly destroyed; the image-ID map has already been destroyed as well. This caused a crash in module lookup during a guest finalizer.
Keep the registry and its mutex alive through process termination. Explicit dlclose still removes a handle and unloads outside the registry lock; remaining native modules are finalized by the host loader. Document the intentional retained allocation and untested Windows teardown ordering.
Add a Unix regression that loads libkernel after registering an exit callback. The callback checks symbol access, callable code, stable loaded-module and image identities, and explicit close after static teardown.
Tested
9265f4e551c5, containing maind1670009fbfd: Linux 1,038 passed / 46 skipped; Windows 714 passed / 389 skipped. Skipped cases remain unvalidated. The regression exercises Unix teardown; Windows teardown ordering remains unverified.Checklist
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T00:22:39Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libkernel.mdL100Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:16:58Z.
Closing: no title is known to reach this on current main (checked against PPSA21564's imports and runs). With the queue this high, please hold off on PRs that don't name a title needing the change. Reopen with the title ID and the log line if a title stops on it on current main.
Pull request closed