App: roll back re-entrant dependent DLLs on LateDlls attach failure #3019
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3019
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3019"
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?
@fuzeofficlal on GitHub · 2026-11-26 03:30 UTC · original
fuzeofficlal:fix/cli-run-reentrant-dll-rollback→main· +158 −8 · 1 files · 1 commits · closed without mergingSummary
LateDlls::loadfails duringDllMain(DLL_PROCESS_ATTACH)inapps/victory/src/run.rs.A.dll'sDllMainre-entrantly calledLoadLibrary("B.dll")whereB.dllstatically or delay-importedA.dll, andA.dll'sDllMainthen returnedFALSE, rollback detached and unloaded only the outernewbatch (A.dll), leavingB.dllregistered inLateDlls::mappedandruntime::IMAGESwith IAT pointers into unmapped memory.reentrant_dependentsto compute the transitive closure of re-entrantly appended modules importing (static or delay-import, ASCII case-insensitive) any module in the failing batch, remove them underself.mapped, detach them in reverse load order before detachingnew[..=i], and forget/unload them before unmappingnew(while preserving independent re-entrant modules).run::reentrant_rollback_testscovering direct dependents, transitive reverse-order rollback, preservation of independent re-entrant modules, and ASCII case-insensitive import matching.Verification
rustfmt --edition 2024 --check apps/victory/src/run.rs: ok.cargo test --locked -p victory: 18 unit tests + 4 integration tests passed.cargo clippy --locked -p victory --all-targets -- -D warnings(default and--all-features): 0 warnings.cargo xtask policy: 191 files ok.@futurepro62 on GitHub · 2026-11-26 04:17 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
92ce3d5(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 870 passed, 0 failed, 10 ignored.direct_reentrant_dependent_is_rolled_back,transitive_reentrant_dependents_rollback_in_reverse_load_order,independent_reentrant_modules_are_preserved,import_matching_ignores_ascii_case.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 06:16 UTC · original
Automated triage for the maintainers.
This changes what
LateDlls::loadinapps/victory/src/run.rsdoes when aDllMainfails. A DLL that aDllMainin the failing batch loaded itself, and that imports a module of that batch (statically, through a delay import or transitively), is now detached and unloaded along with the batch. The newreentrant_dependentshelper is tidy and its four tests cover its index logic. What is missing is evidence that this is the behaviour to emulate:LoadLibrarydoes, but gives no reference. On Windows, a DLL loaded by its ownLoadLibrarycall insideDllMainholds its own reference, and its static import of the failing module adds a reference to that one too. Whether the Windows loader then tears it down, leaves it loaded or keeps the outer module mapped needs a citation or a small Windows test that shows the outcome. As written, the change could replace one wrong state with another.DllMainthat fails after loading a DLL that imports it back). A concrete case, or a run log showing the dangling module, would show the change is worth its complexity.loaditself: dependents first, thennew[..=i]in reverse, withforget_imagebeforeunload.With a reference for the Windows behaviour, and ideally a case that hits it, this could be re-triaged.
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 06:27 UTC · original
Agreed — without a concrete title hitting re-entrant dependent DLL failure during
DllMainor a verified test of native WindowsLoadLibraryrefcount semantics for this case, the added rollback complexity is not justified. Closing.Pull request closed