Loader (diagnostics): VICTORY_POKE writes through the page's protection #2659
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!2659
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2659"
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?
@kotekompotek on GitHub · 2026-11-25 17:42 UTC · original
kotekompotek:loader/poke-write-protect→main· +68 −5 · 3 files · 1 commits · openSummary
VICTORY_POKEwrote the byte with a raw volatile store, so poking an rva in the title's read-execute.text(e.g.:0x90over an assert'sint3) raised an access violation in victory.exe itself (0xc0000005atvictory.exe+0x524eb) before the title ran.victory_loader::write_title_byte:VirtualQuerythe address,VirtualProtectthe page writable for the write, restore its protection, flush the instruction cache on executable pages. Committed-writable pages take the same fast path as before.run.rs::pokenow goes through the helper; doc updated (code pages work too).Test plan
VICTORY_POKE=0x1ce6e13:0x90on the Series 1.0.2.1 image: previously AV'd the host insidepoke; now writes through and the run continues past the site.cargo check -p victory --features diagnostics,cargo clippy -p victory-loader -p victory --all-targets --all-features --locked -- -D warningsNote: for skipping
int3asserts entirely, #2644'sVICTORY_STEP_OVERis the better tool (no writes needed); this fixes poke for data bytes on read-only pages and for anyone who still wants code patching.Generated with Devin
@Marvisak on GitHub · 2026-11-25 22:21 UTC · original · edited 2026-11-26 00:24 UTC
Automated triage for the maintainers.
Recommended for a maintainer's look. With the two unrelated GPU commits dropped, the branch now holds only the
VICTORY_POKEchange.victory_loader::write_title_byte(crates/victory-loader/src/crash.rs, diagnostics-only) queries the page and, if it isn't writable, makes it writable for the one-byte write. It then restores the old protection and flushes the instruction cache on executable pages.pokeinapps/victory/src/run.rsuses it, so poking a byte in read-only title pages no longer crashes the host. It merges cleanly and CIcheck(including the all-features clippy on Windows) is passing.On your reply: confirmed. The diff against
mainis now onlyrun.rs,crash.rsand thelib.rsre-export.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 22:57 UTC · original
Done — the two GPU commits are dropped; the branch now carries only the VICTORY_POKE commit (
e8ccc39) on main. The host_desc change stays in #2442 where it belongs.@fuzeofficlal on GitHub · 2026-11-26 00:35 UTC · original
Code review and Windows 11 verification at head
e8ccc396353fmerged cleanly ontomain(63bcca43c6a0):write_title_byte(crash.rs), its re-export (lib.rs), andpoke(run.rs) stay strictly behind#[cfg(all(windows, feature = "diagnostics"))].write_title_bytechecksVirtualQuery(MEM_COMMIT), checks base writability viainfo.Protect & 0xFF, preserves execute bits (PAGE_EXECUTE_READWRITEvsPAGE_READWRITE) on a page-alignedVirtualProtect, restoresoldprotection afterwrite_volatile, and callsFlushInstructionCacheon executable pages.write_title_byteagainst aPAGE_READONLY/PAGE_EXECUTE_READpage would lock in both the write and protection restoration.PAGE_READWRITE | PAGE_GUARD,base_protectmatches writable sowrite_volatilewould raise a guard fault directly (not an issue for.text/.rdatapokes, just worth noting).cargo xtask policy:191 files okcargo clippy --locked -p victory-loader -p victory --tests -- -D warnings(default +--all-features): 0 warningscargo test --locked -p victory-loader: 35/35 unit + 4/4 integration (crash_log,load_probe,title_dlls) passedcargo test --locked -p victory-loader --all-features: 37/37 unit + 4/4 integration passedLooks clean and ready to merge.
@futurepro62 on GitHub · 2026-11-26 11:33 UTC · original
NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head
e8ccc39(on its base219878a).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: 864 passed, 0 failed, 10 ignored.#[test]functions in the diff.--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
@fuzeofficlal on GitHub · 2026-11-26 12:21 UTC · original · approved these changes
Reviewed and verified at head
e8ccc396againstorigin/main(63bcca43) on Windows 11 (debug & release, default &--all-features):victory_loader::write_title_byte(crates/victory-loader/src/crash.rs:54-110), its re-export (crates/victory-loader/src/lib.rs:45), and its callerpoke(apps/victory/src/run.rs:286-305) stay strictly gated behind#[cfg(all(windows, feature = "diagnostics"))].VirtualQuerysafely rejects uncommitted memory (queried == 0 || info.State != MEM_COMMIT); non-writable pages preserve executability (PAGE_EXECUTE_READWRITEwheninfo.Protect & 0xF0 != 0, elsePAGE_READWRITE) on a 4 KiB-alignedVirtualProtect, handleVirtualProtectfailure cleanly without writing, restoreoldprotection afterward, and flush the instruction cache on executable pages.base_protect = info.Protect & 0xFFmasks offPAGE_GUARD, aPAGE_READWRITE | PAGE_GUARDpage enters the writable fast path and raisesSTATUS_GUARD_PAGE_VIOLATION(0x80000001), whereasPAGE_READONLY | PAGE_GUARDgoes throughVirtualProtectand restoresPAGE_READONLY | PAGE_GUARDcleanly. Checkinginfo.Protect & PAGE_GUARD == 0inwritablewould cover that uniformly if ever hit outside normal PE sections.PAGE_EXECUTE_READWRITE/PAGE_EXECUTE_WRITECOPY) takes the fast path without callingFlushInstructionCache(benign on x86-64).PAGE_READONLY,PAGE_EXECUTE_READ, andMEM_RESERVEwould lock in protection restoration.git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(190 files ok);cargo clippy -p victory-loader -p victory --all-targets --locked -- -D warningsclean with default features and--all-features.cargo test -p victory-loader --locked: 35 unit + 4 integration passed (default), 37 unit + 4 integration passed (--all-features, both debug and--release);cargo check -p victoryclean in both dev default and--release --all-features.write_title_bytedirectly againstPAGE_READWRITE,PAGE_READONLY,PAGE_EXECUTE_READ,PAGE_NOACCESS,MEM_RESERVE, andPAGE_READONLY | PAGE_GUARDallocations on Windows 11—all wrote and restored exact original protections (and returnedfalseonMEM_RESERVE).LGTM.
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.