Loader: rebase of #1156 (continue past a title's int3 asserts) onto current main #2165
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!2165
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2165"
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?
@Key-rs on GitHub · 2026-11-25 06:45 UTC · original
Key-rs:loader/title-asserts-rebased→main· +153 −1 · 2 files · 4 commits · openWhat
Rebases #1156 (
loader/title-asserts) onto currentmain(940d32f), which is what it needs to be mergeable again — GitHub reports the original asCONFLICTING.No behaviour change is intended: the two commits are the same two, with the conflict in
crates/victory-loader/src/crash.rsresolved.The conflict, and how it was resolved
maingrew alet code = …binding and ato_filecomputation between the time #1156 was opened and now, while the patch inserts itspast_assertcall at the top of the same handler. Both want the same place:So
main's structure is kept whole and the skip is inserted ahead of it, which is also the order that matters: an assert that is skipped must not be reported as a first-chance exception on its way past.Checked
cargo build --release -p victoryon Windows 11 (Rust 1.98.1, MSVC): clean, no warnings from the touched file.VICTORY_TITLE_ASSERTS=<n>, and the skip path logsVIctory: past a title assert at … (<n> left)followed by the title's own last debug output.Why this is worth landing (a data point from this week)
The reason it matters is not only "find the next blocker": the assert it skips first on some machines is survivable in the strong sense. On a Ryzen 7 8845H + RTX 4060 Laptop (Windows 11 26300), the title traps at
+0x1330A44on every run from a cold cache, and with the two jumps into thatint3nop'd (a narrower variant of this switch,fxceless/victory-fork#719) the same build reaches the first-boot screens, the legal notices, the network announcements and the game itself, holding 30 fps for a 325-second run with no crash log. So this class of assert is exactly where "continue and see" pays off, and the generic form is the right one to have in the tree.I left the original #1156 open; this PR exists so the rebase is available to it. If you would rather have the branch pushed to the original author's fork instead, say so and I will hand it over rather than opening a competing PR.
Refs #1156, #2013, #1736.
@Key-rs on GitHub · 2026-11-25 08:24 UTC · original
Thank you both for running it on your own machines — and for the note about the three macOS failures being the same on main, that saves me from chasing them.
For the record, the state of the two related threads:
Nothing else is pending from my side — the branch is at
940d32fwith the two commits and no local changes.@Marvisak on GitHub · 2026-11-25 12:36 UTC · original
Automated triage for the maintainers.
Merge candidate. This is #1156 (adamdotpy), rebased onto
main. It adds an opt-in debugging switch,VICTORY_TITLE_ASSERTS=<n>, off by default. With it set, the crash handler incrates/victory-loader/src/crash.rscontinues past up tontitleint3asserts instead of ending the process. Each skip is logged with its address and the title's last debug output.What I checked:
past_assertruns only forEXCEPTION_BREAKPOINTand only when the byte at the exception address is0xcc. On x64 Windows that address is theint3itself, soRip = at + 1resumes at the next instruction.emulate_amd_onlystill runs first.a_title_int3_is_skipped_while_the_budget_lastscovers the byte check, other exception codes and the budget.CI
checkpasses, and the branch merges cleanly.For the maintainers: #1156 is the same change and conflicts with
main. Whichever lands, the other should be closed.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 01:02 UTC · original
Code review and Windows 11 verification at head
135d954b0818merged cleanly ontomain(63bcca43c6a0):The single-byte
0xCCinstruction check (crash.rs:575-587, avoiding 2-byteCD 03and hardware breakpoints) and VEH ordering withwatch.rs(First=1vsFirst=0) look good, andcargo xtask policy(191 files ok),clippy(0 warnings), andvictory-loadertests (36+4default /38+4--all-features) pass.Two issues worth fixing before merge:
crates/victory-loader/src/crash.rs:577,585):skip_assert_atchecksleft.load(Relaxed) == 0and then unconditionally callsleft.fetch_sub(1, Relaxed). If two threads hit0xCCconcurrently whenleft == 1, both can pass the zero check and decrementlefttousize::MAX, effectively disabling the budget cap forever.fetch_updatewith|n| n.checked_sub(1)makes the budget check-and-decrement atomic.past_assert/skip_assert_at):atis never checked to fall within mapped title code ranges. WhenVICTORY_TITLE_ASSERTS > 0, any0xCCbreakpoint from a host DLL (e.g.ntdll!DbgBreakPoint, CRT__debugbreak, Rust debug asserts, or D3D12 debug layer) will also be skipped and consume the title's assert budget. Scopingskip_assert_atto title image ranges keeps host breakpoints intact.@DenRakEiw on GitHub · 2026-11-25 07:24 UTC · original · approved these changes
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-loader --lib a_title_int3_is_skipped_while_the_budget_lasts— passedcargo clippy -p victory-loader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean rebase of opt-in title
int3assert continuation with bounded skip budget and unit test coverage. Looks good.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 07:24 UTC · original · approved these changes
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-loader --locked.Loader tests: 2 passed / 3 failed — the 3 failures are the known pre-existing macOS ones (prepare::tests parse this Mac's Mach-O test binary as PE; identical on main). Rebase of #1156 (continue past a title's int3 asserts) — loader resilience fix, Windows behavior unchanged in kind.
@Key-rs on GitHub · 2026-11-26 11:03 UTC · original
Both fixed in
c891db6, thank you — the first one is a real race and the second is a hole I did not think about.1. The budget. It is now taken in the step it is checked:
ust fn take_budget(left: &AtomicUsize) -> bool { left.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |n| n.checked_sub(1)).is_ok() }So two threads at the last assert cannot both pass and wrap the counter. The test that used to call skip_assert_at on a heap buffer now exercises ake_budget directly (spend, spend, refuse, and no wrap on the second attempt).
2. The address range. skip_assert_at now asks in_title_image(at), which uses GetModuleHandleExW(FROM_ADDRESS) on the faulting address and accepts only the loader's own name for the title image (ictory-image-.dll, prepare.rs:30):
ust let name = path.rsplit('\\').next().unwrap_or(&path); name.starts_with("victory-image-")A ␀xcc in
tdll, a CRT __debugbreak, a Rust debug assert or the D3D12 debug layer now goes to the handlers after this one, as it should.
Consequence worth stating: the existing unit test could no longer assert "a heap ␀xcc is skipped", because a heap address is by definition not in the title's image. It now asserts the opposite — that such an address is not skipped and does not spend the budget — which is the property you asked for. The skip path itself is only covered by running a title, and that is where I tested it: on a retail dump with VICTORY_TITLE_ASSERTS=8 the trap at +0x1330A44 is skipped and logged with its ictory-image-…+0x… name.
Checks after the change: cargo xtask policy (182 files ok), cargo clippy -p victory-loader --all-targets -- -D warnings (clean), cargo test -p victory-loader (35 + 1 + 2 + 1 pass).
One thing I did not change, in case you want it: ake_budget uses Relaxed on both sides. The count is only ever read for the log line, so ordering does not matter for correctness, but if you would rather it be AcqRel for the counter itself, say so and I will change it.
@fuzeofficlal on GitHub · 2026-11-26 11:39 UTC · original · approved these changes
Reviewed and verified
c891db65on Windows 11 x64.take_budgetusesfetch_update(..., |n| n.checked_sub(1)), eliminating the concurrent last-assert underflow race cleanly.in_title_imagescopes skipping to modules matchingvictory-image-(PreparedImage::file_name(), covering both the main title image andload_title_dll/load_title_dlls), keeping host DLL, CRT, Rust debug assert, and D3D12 debug layer breakpoints intact.past_assertruns afteremulate_amd_onlyand before first-chanceFATALreporting, advancingcontext.Ripby 1 past single-byte0xcc.Verified locally on Windows 11 (Rust 1.98.1 MSVC):
cargo xtask policy(182 files ok) andcargo clippy -p victory-loader --tests -- -D warnings(default and--all-features): clean.cargo test -p victory-loader(dev, default): 35 lib + 4 integration tests passed;--all-features: 37 lib + 4 integration tests passed.cargo test --release -p victory-loader(default): 35 lib + 4 integration tests passed;--all-features: 37 lib + 4 integration tests passed.One minor non-blocking suggestion: checking
if left.load(Ordering::Relaxed) == 0 { return false; }at the top ofskip_assert_at(while keepingtake_budget's atomicfetch_updateat the end) would make the default-off and budget-exhausted paths skip the byte read andGetModuleHandleExW/Stringallocation completely.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.