Repository navigation
fix(gpu): stop copy_mapped on non-writable title destinations instead of faulting - #3358
Open
reeledMarek wants to merge 1 commit into
Open
reeledMarek wants to merge 1 commit into
reeledMarek wants to merge 1 commit into
Conversation
Dukestar69
approved these changes
Nov 26, 2026
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows against origin/main (63bcca4).
- Checking
writable(dst, len)(instead of onlycommitted) and usingread(ZERO_4K.as_ptr(), to, n)ontitle_dstpreventscopy_mappedfrom faulting on read-only title destination pages during the fallback path. cargo test -p victory-gpu --lib host::title_copies:: -- --test-threads=1: 3 passed, 0 failed (includingtitle_copies_do_not_fault_on_read_only_destinations).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).
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
copy_mapped(dst, src, len, title_dst = true)fails its initialReadProcessMemorycall because the destination contains committedPAGE_READONLY(or execute-only) pages,crate::texture::committed(dst, len)previously returnedtrue(sincecommittedonly rejectsPAGE_NOACCESS | PAGE_GUARDfor readable sources).read()on each 4 KiB piece and executedunsafe { to.write_bytes(0, n) }, causing an immediate access violation on the read-only title destination.writable(dst, len)check (requiringMEM_COMMIT, noPAGE_NOACCESS | PAGE_GUARD, and a writable base protection) before entering the fallback fortitle_dst, and routestitle_dstzero-fills throughread(ZERO_4K.as_ptr(), to, n)so concurrent protection changes cannot fault either.title_copies::title_copies_do_not_fault_on_read_only_destinationsusingVirtualProtect(..., PAGE_READONLY).Verification
cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --locked