feat(libkernel): honour RTLD_NODELETE and RTLD_NOLOAD in dlopen, as FreeBSD 11 rtld does #27297
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27297"
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 kiansaeidnia on 2026-11-25T19:08:57Z.
What
dlopenrefused every flag outside the mode andRTLD_GLOBAL. It now acceptsRTLD_NODELETE(0x1000) andRTLD_NOLOAD(0x2000), with the meanings FreeBSD 11 rtld gives them throughRTLD_LO_NODELETEandRTLD_LO_NOLOAD:RTLD_NOLOADreturns a new referenced handle only for an image the process already has loaded (GetModuleHandleExWon Windows, the hostRTLD_NOLOADelsewhere). As rtldload_objectdoes, a miss on an existing file returns NULL and leavesdlerroruntouched; a file that does not exist sets a "was not found" message.RTLD_NODELETEpins the host image (GET_MODULE_HANDLE_EX_FLAG_PINon Windows, the hostRTLD_NODELETEelsewhere), and the lastdlclosekeeps its guest image registration.Other bits, such as
RTLD_TRACE, still return NULL with adlerrormessage. A new libkernel Functional debt entry records them, together with the WindowsRTLD_NOLOADlookup that matches by path or base name rather than by file identity.Tested
Windows 11, MinGW-w64 GCC 16.2, Release:
guest_dynamic_loaderandguest_dynamic_loader_variant_namespass. The new checks inGuestDynamicLoader.cppcover:RTLD_NOLOADbefore the module is loaded returns NULL with nodlerror, also withRTLD_NODELETE.RTLD_NOLOADon a missing file sets "was not found".RTLD_TRACE, 0x4000 and mode 3 withRTLD_NOLOADare still refused with a message.RTLD_NOLOADon a loaded module returns a second handle that resolves the same symbol and keeps the image alive after the first handle is closed.RTLD_NODELETE, closing every handle leaves the code callable and the guest image registration unchanged, and a laterRTLD_NOLOADfinds it.DynamicLoader.cppand the test were syntax-checked with g++ 11 on Linux (WSL Ubuntu); the Linux and macOS paths have not been run here.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T19:17:42Z.
Review: COMMENTED
Reviewed — no blocking findings
No verified blocking defect was found in the inspected changes; the reported Windows tests were not run in this review.
What I ran
Reviewed head
1f4afa20c9048ac96ce421dc88436891153124f8using the prepared diff andrepo_read.pyat the pinned head. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The test suite and runtime behavior were not independently verified. The PR description reports Windows 11 tests and Linux syntax checks; Linux and macOS runtime paths were not reported as run. The full contents of the changed files were not read; targeted portions relevant to the diff were inspected.
files.jsonwas not available through the reader, so its excluded-file list was not verified.To get this to a good state
Nothing is required.