Guard only title memory in vkback's live guards #141
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!141
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-141"
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?
@firefloc on GitHub · 2026-12-01 20:54 UTC · original
firefloc:fix/live-guards-title-memory-only→main· +121 −3 · 2 files · 1 commits · merged 2026-12-01 21:13 UTCWhat
Fixes #139. vkback's live guards (
watch::live::live_protect) made blocks read-only whatever lay there. A texture range the title names at0x1_0000_0000covers two Wine thread stacks. The whole-runVirtualProtectfailed across their views, and the block-by-block retry then made all 32 blocks read-only. The thread owning the upper stack faulted at once in__wine_syscall_dispatcherwriting its syscall frame, and the process died.live_protectnow guards only the blocks thatis_viewaccepts (umem's mappings, views, or nothing mapped now), asguarddoes. A block outside title memory stays writable; it is counted inLIVE_NOT_TITLE, and the first 16 are logged with their address (rule 9a). Guarding memory that is not the title's is not a console behaviour: on the console, a write the title makes there is not a write to a texture we must refill.The reference
The D3D12 path's counterpart is
watch::guard. It refuses a rangeis_viewrejects (if !known && !is_view(start, end)) before protecting anything.live_protectnow asks the same question per block. It leaves outguard's per-rangeknownshortcut, because the live path keeps no such record. Carried over unchanged: the existingkernel/changingexclusions andgpu_only_blocks.is_viewalready counts umem's mappings as views (umem_has), so the guarded umem blocks stay guarded.Evidence
Machine: RX 7900 XTX (RADV, Mesa 26.3.1), Ryzen 7 7800X3D, GE-Proton 11-14, Series X mode.
5930321plus fork commits that touch none of these files): three cores show the same first fault. A GDB probe onmprotect/mmap/munmap/mremapover[0x1_0000_0000, 0x1_0020_0000)caught the 32mprotect(block, 0x10000, PROT_READ)calls fromNtProtectVirtualMemory(kernelbaseVirtualProtect), and/proc/<pid>/mapsshowed both stacks turnr--pthe same second. Details are in #139 anddocs/learnings/wine-unixlib.md.victory.exerebuilt, the same scenario from a blank save): the refusals are logged from0x1_0000_0000on, as the first texture guards go up after entering the world. Both stacks stayrw-pin every/proc/<pid>/mapssample. The run passed the point where the earlier runs died and ended normally (EXIT 0), with no core.watch::live::tests::live_guards_leave_memory_that_is_no_title_memory_writablecallslive_protecton private memory and on a view. Private memory staysPAGE_READWRITEand is counted, while the view becomesPAGE_READONLY. Without the filter, the test fails on the private memory's protection.cargo xwin clippy -p victory-gpu --target x86_64-pc-windows-msvc --all-targets -- -D warningsis clean.cargo xwin test -p victory-gpu --libundertools/proton-run.sh(GE-Proton 11-14): 124 passed, 0 failed, 1 ignored.VirtualProtect. It changes no Vulkan call vkback or umem makes, and no SPIR-V.What this does not prove: that no legitimate texture lived in title memory outside umem and the views, which would now lose its guard. On this run, every refused block was in the Wine stacks' range. The counter makes any other case visible.
Checklist (docs/AGENTS.md)
docs/TASKS.mdnot edited, the fixed item named above (rule 29)unsafeblock has a// SAFETY:comment; no raw pointer around the borrow checker (rule 36): nounsafeaddedTRANSLATOR_VERSIONbumped if the translator's output changes (rule 27): translator untouchedThe underlying overlap, Wine's stacks inside the title window and the title naming addresses there, is reported separately in #140 (rule 29).
https://claude.ai/code/session_01PNfsy7diUPSn7uaRkqv9iJ
@vktory6 on GitHub · 2026-12-01 21:15 UTC · original
Merged as
github.com/vktory6/VKtory@77a61b9, thanks. It followsguard's own question per block, the counter makes any other case visible, and the test calls the production code. Our check: build and tests pass, and a house validation run on an RX 9070 XT showed no new errors. On our machine (a different Proton build) Wine's stacks don't land at the bottom of the title window: 0 refusals, so the change is a no-op here and fixes your setup.The overlap itself is a task now (from #140): "Wine's first thread stacks lie inside the title window".
If you're looking for a next topic: the anti-stutter tasks in docs/TASKS.md ("Texture fills on the GPU", "Renderer CPU: index slots", "Placed image creation in the streaming phase") have the largest measured payoff right now.