GPU: keep untracked pages writable in Tracked::taken #3011
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3013"
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 Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T03:25:49Z.
Summary
pagesincrates/victory-gpu/src/watch.rs::Tracked::takenagainstg.holdersforself.changedbefore callingaliases,guard_aliases, andprotect, returning early if none of the pages belong to this tracker.Shadowbuffer or 4 MiB loose window spans bothMEM_WRITE_WATCHruntime pages and adjacent untracked/foreign committed pages: previouslyShadow::copy_back,copy_back_page, andcopy_back_markedcalledt.taken(...), which passed untracked pages toVirtualProtect(..., PAGE_READONLY)and inserted them intog.protectedwithout ag.holdersentry (leaving them permanently read-only even afterTracked::drop, and risking a VEH + heap-lock deadlock if a process-heap page is touched).watch::tests::taken_skips_untracked_and_foreign_pagescovering both directTracked::takenon a mixed foreign/pool window and end-to-endShadow::copy_back+Shadow::copy_back_pageover adjacent pool and plain committed pages.Verification
watch::tests::taken_skips_untracked_and_foreign_pagesfails onmain(PAGE_READONLYinstead ofPAGE_READWRITE) and passes with the fix.cargo test --locked -p victory-gpu watch::tests::: 16/16 passed on RTX 5090 (shadow::tests::9/9 passed).VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --all-features: 247 passed, 0 failed, 1 ignored.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features): 0 warnings.cargo xtask policy: 191 files ok.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T03:32:58Z.
Review: APPROVED
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-gpu --lib watch::tests: 16 passed, 0 failed (including newtaken_skips_untracked_and_foreign_pages).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-26T03:29:15Z.
Exact PR head
0f2fb8c55b1a7c9814c5eeada6ee3de0cebf3d87, Windows-target Wine 11.0/vkd3d-proton 3.2.0 on a 16 GiB host with physical NVIDIA RTX 4060 Laptop GPU (8 GiB) (dxgi.hideNvidiaGpu = False):watch::tests::taken_skips_untracked_and_foreign_pages1/1 passed, 0 ignored. Build log confirmsCompiling victory-gpufrom the clean PR checkout, and DXVK enumerated the laptop NVIDIA adapter. The regression exercises direct mixed owned/foreign pages andShadow::copy_back/copy_back_page; it leaves foreign/plain pagesPAGE_READWRITEwhile guarding only the tracked page. Local log:.compat-runtime/logs/verify-pr3013-wine-mixed-pages.log(not attached).This is a useful Wine page-protection/liveness check, not a GPU command-dispatch or guarded title test; device enumeration does not mean this fixture rendered on the GPU. It does not resolve the separate 16 GiB world-load RAM floor, so no gameplay/FPS claim.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:39:06Z.
Review: APPROVED
LGTM — filtering pages to this tracker's holders before aliases/protect stops foreign and untracked pages inside a buffer window from being left read-only. Lock ordering still covers protect+remove; the test lays out a foreign + write-watch page in one window.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:51Z.
Automated triage for the maintainers.
In
main,Tracked::taken(victory-gpu/src/watch.rs) protects every page its caller passes in. Two callers can pass pages that this tracker never registered ing.holders:Shadow::copy_backpasses every synced page in range.copy_back_pagepasses the page it wrote.Such pages include foreign or plain committed memory inside a buffer or window. They get made
PAGE_READONLYand added tog.protected, andTracked::dropnever unprotects them, because it only walks the tracker's own pages. The PR filters the pages down to those this tracker holds before the alias andprotectsteps. It keeps the existing lock order (guards first, thenchanged) and returns early when no pages are left. The new test covers directtakencalls and bothShadowcopy-back paths over a mix of write-watched and plain pages.This looks like a real fix for a latent leak of read-only protection onto memory the tracker doesn't own.
CI:
checkpassing.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.