Repository navigation
GPU: every region of a tracked range must be the runtime's - #2345
Open
crashbashash wants to merge 2 commits into
Open
crashbashash wants to merge 2 commits into
crashbashash wants to merge 2 commits into
Conversation
A loose copy of title memory for a null address covers 0..4 MiB, and `runtime_memory` took that free memory for a view or placeholder, so the window was tracked and its blocks guarded. On Windows nothing is committed there and the guards fail. Under Wine the process heap is, its pages became read-only, and a heap write by a thread holding the guard lock (in `Tracked::take`, `writing` or the fault handler itself) faulted into the handler, which waited for that lock forever: the title stopped at the end of loading.
runtime_memory looked at the first page only, so a range starting in a reservation with plain committed memory further in was still guarded, and a write there blocked whoever allocated it (as in free memory). Each region of the range is checked now (VirtualQuery walk); a range with any free or plain committed region is not tracked and is copied whole instead. track runs when a copy is made, not per submission. Reported by astrosteveo on Marvisak#1849.
DenRakEiw
approved these changes
Nov 25, 2026
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f):
- Walking every VirtualQuery region across the tracked range and rejecting
MEM_FREEas well as plain committedMEM_PRIVATEregions further inside the range cleanly avoids guarding unrelated heap/free memory. cargo test -p victory-gpu watch::tests: 8/8 passed (includingfree_memory_is_not_trackedandcommitted_memory_further_in_is_not_tracked).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.
AI-assisted (Gemini 4 Neon).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runtime_memorydecides whetherwatch::trackmay guard a range, but it looks only at the range's first page. A range that starts in runtime memory (a write-watched pool, a view or a placeholder) and runs into plain committed memory further in passes, and that memory gets guarded too. A write there from a thread holding the guard lock then never returns, the same deadlock #1849 fixes for free memory. astrosteveo reproduced it with a synthetic test on #1849.Stacked on #1849: the first commit is #1849 unchanged; please review only the second,
f5e46bd.Change
runtime_memory(start, end, views)walks every region of[start, end)withVirtualQuery. Each region must be what one page had to be before: write-watched, or (withviews) a view or placeholder, i.e. neither free nor plain committed private memory. A range with any other region isn't tracked, and is copied whole like any untracked memory.trackcalls it once, when the copy is made, so the walk doesn't run per submission.#2237 (mapped image memory) changes the same check and also looks at the first page only. Whichever of the two merges second needs a one-line conflict fix; with this PR, #2237's image rule would hold for every region of the range.
Testing
watch::tests::committed_memory_further_in_is_not_tracked: a two-block reservation with its second block committed. Tracking the reserved block alone works; tracking both is refused (onmainit's accepted).cargo xwin clippy -p victory-gpu --all-targets [--all-features] --locked -- -D warnings: clean.victory-gputests under Wine (GE-Proton11-14, MSVC build): 80 passed, 1 ignored.Not tested: Windows.
AI-assisted (Claude Code). No game data attached.