[Intel CPU] a_clzero_loop_becomes_plain_stores fails when crash::tests::clzero_loops_end_like_their_last_pass runs first #167
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay#167
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@samuelcurcelicordovil-collab on GitHub · 2026-11-27 05:28 UTC · original
A title-free test run (no game files) on an Intel CPU. Everything passes except one victory-loader test, which fails only when a particular crash test runs before it in the same process.
Vice-Tay build
02b693e(main, git clone), defaultcargo testprofile, Rust 1.98.1 fromrust-toolchain.toml.console_insn.rsandcrash.rsare unchanged on the currentmain(93f3b5f).Hardware and graphics driver
Intel Core i9-12900F (16 cores / 24 threads, no CLZERO), 32 GB DDR4-3200, NVIDIA GeForce RTX 4070 SUPER 12 GB, driver 621.40 (clean install), Windows 11 Pro 25H2 build 26200.9974, feature level 12_2, WDDM 3.2.
How to reproduce
cargo test --workspace --lockedfailed in 1 of 2 runs. To get it every time, fix the order with a shuffle seed. The shuffle flags are unstable, soRUSTC_BOOTSTRAPis set for the test binary only:It fails exactly when
crash::tests::clzero_loops_end_like_their_last_passruns first:clzero_loops_end_like_their_last_passrunsa_clzero_loop_becomes_plain_storesWhat you observed
The rest of the workspace passes:
cargo test --workspace --locked --no-fail-fastgave 1141 passed, 0 failed, 54 ignored.cargo test --locked -p victory-gpu --lib -- --test-threads=1gave 433 passed, 0 failed, 42 ignored. No TDR ornvlddmkmevents during the runs.Likely cause
crash::tests::clzero_loops_end_like_their_last_passruns a realclzeroloop from the test binary's.text. On Intel that raises#UD, and the vectored handler callsconsole_insn::emulate, which callspatch_clzero.patch_clzerosets the process-wideSTUBSregion withnear(at), so it lands near the test executable's image.a_clzero_loop_becomes_plain_storesputs its loop in a page fromVirtualAlloc(NULL, …), normally more than 2 GB from that image. Therel32jumps injump(at, stub)andclzero_stubcannot reach,patch_clzeroreturnsfalse, and the byte atpage + 16stays0x0finstead of0xe9.Of the ways
patch_clzerocan returnfalse, reach is the only one that plausibly depends on what ran before. On AMD (Zen has CLZERO) step 1 never faults, which would explain why it does not show up there. In the game it is probably harmless, since the title'sclzeroloops all sit in one image.Two possible fixes: have
patch_clzerotake a new region withnear(at)when the current one is out of reach, instead of giving up; or have the test allocate its page within reach ofSTUBS.I can rerun the tests or try a fix on this machine.
AI-assisted (Claude)
@TaynanGT on GitHub · 2026-11-27 05:46 UTC · original
Thanks for isolating the test order, @samuelcurcelicordovil-collab. I reproduced the
a jumpassertion on Windows by pre-seeding the shared stub bank near the test image. The fixture in #170 now allocates the test loop near that bank, so both jumps stay within range.All five CLZERO tests passed locally with the corrected fixture.
@samuelcurcelicordovil-collab on GitHub · 2026-11-27 05:53 UTC · original
Confirmed fixed on the same Intel machine (i9-12900F, no CLZERO),
mainat8ed3c01, which includes #170:clzero --test-threads=1: 20 of 20 pass. In 10 of them (5, 6, 7, 9, 10, 11, 13, 14, 17, 20)crash::tests::clzero_loops_end_like_their_last_passran first. Before #170 that order failed every time.victory-loaderlib tests: 63 passed, 0 failed.Thanks for the quick fix. This can be closed from my side.
AI-assisted (Claude)
@TaynanGT on GitHub · 2026-11-27 06:02 UTC · original
Thanks for retesting on the i9-12900F, @samuelcurcelicordovil-collab. All 20 shuffled runs passed, including 10 with the previously failing order. That confirms #170 on the machine that hit the failure.