loader/crash: fix unwritable CLZERO fallthrough AV, page-boundary ove… #528

Open
github-bot wants to merge 1 commit from github-bot/gh-528 into main AGit
Owner

@⁠pug205gti6 on GitHub · 2026-11-25 02:00 UTC · original
pug205gti6:pr/478-loader-crash → main · +144 −34 · 1 files · 1 commits · open

…rreads, and thrown() NULL derefs

Fix three VEH / crash-reporter fault hazards in crates/victory-loader/src/crash.rs:

  1. In emulate_amd_only, verify the 64-byte clzero target line is committed and writable via VirtualQuery before calling write_bytes(0, 64), so an unwritable clzero that console_insn::emulate rejected does not fall through and trigger a nested Access Violation inside the VEH.
  2. Copy page-bounded instruction bytes (room = 0x1000 - (Rip & 0xfff)) before inspecting [0x0f, 0x01, ...] or clwb_len, and pass the bounded slice &bytes[..n] into a safe slice-based sse4a(&[u8], ...) so 1–6 byte illegal instructions at the end of a page adjacent to an unmapped/no-access page cannot fault while decoding.
  3. In thrown(), handle MSVC throw; rethrows (p[2] == 0 || p[3] == 0), guard rva(types) == 0 / zero catchable type count before calling name(0), and require p[1] != 0 before reading std::exception's message pointer.

Add synthetic unit tests for all three failure modes.

**@⁠pug205gti6** on GitHub · 2026-11-25 02:00 UTC · [original](https://github.com/fxceless/victory-fork/pull/528) `pug205gti6:pr/478-loader-crash` → `main` · +144 −34 · 1 files · 1 commits · open …rreads, and thrown() NULL derefs Fix three VEH / crash-reporter fault hazards in `crates/victory-loader/src/crash.rs`: 1. In `emulate_amd_only`, verify the 64-byte `clzero` target line is committed and writable via `VirtualQuery` before calling `write_bytes(0, 64)`, so an unwritable `clzero` that `console_insn::emulate` rejected does not fall through and trigger a nested Access Violation inside the VEH. 2. Copy page-bounded instruction bytes (`room = 0x1000 - (Rip & 0xfff)`) before inspecting `[0x0f, 0x01, ...]` or `clwb_len`, and pass the bounded slice `&bytes[..n]` into a safe slice-based `sse4a(&[u8], ...)` so 1–6 byte illegal instructions at the end of a page adjacent to an unmapped/no-access page cannot fault while decoding. 3. In `thrown()`, handle MSVC `throw;` rethrows (`p[2] == 0 || p[3] == 0`), guard `rva(types) == 0` / zero catchable type count before calling `name(0)`, and require `p[1] != 0` before reading `std::exception`'s message pointer. Add synthetic unit tests for all three failure modes.
Fix three VEH / crash-reporter fault hazards in `crates/victory-loader/src/crash.rs`:
1. In `emulate_amd_only`, verify the 64-byte `clzero` target line is committed and writable via `VirtualQuery` before calling `write_bytes(0, 64)`, so an unwritable `clzero` that `console_insn::emulate` rejected does not fall through and trigger a nested Access Violation inside the VEH.
2. Copy page-bounded instruction bytes (`room = 0x1000 - (Rip & 0xfff)`) before inspecting `[0x0f, 0x01, ...]` or `clwb_len`, and pass the bounded slice `&bytes[..n]` into a safe slice-based `sse4a(&[u8], ...)` so 1–6 byte illegal instructions at the end of a page adjacent to an unmapped/no-access page cannot fault while decoding.
3. In `thrown()`, handle MSVC `throw;` rethrows (`p[2] == 0 || p[3] == 0`), guard `rva(types) == 0` / zero catchable type count before calling `name(0)`, and require `p[1] != 0` before reading `std::exception`'s message pointer.

Add synthetic unit tests for all three failure modes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:45:29 +00:00
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 09:22 UTC · original

Independent verification: PR #528 merges cleanly onto main, no conflicts. Build: success (8.61s). Tests: 253 passed, 1 failed (pre-existing Wine issue in victory-hle only_loopback_is_reachable test — confirmed failing on main without PR). PR modifies crates/victory-loader/src/crash.rs (144 insertions, 34 deletions) to fix CLZERO fallthrough AV, page-boundary overreads, and thrown() NULL derefs. No new build errors or test regressions. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/528#issuecomment-7158238467) Independent verification: PR #528 merges cleanly onto main, no conflicts. Build: success (8.61s). Tests: 253 passed, 1 failed (pre-existing Wine issue in victory-hle only_loopback_is_reachable test — confirmed failing on main without PR). PR modifies crates/victory-loader/src/crash.rs (144 insertions, 34 deletions) to fix CLZERO fallthrough AV, page-boundary overreads, and thrown() NULL derefs. No new build errors or test regressions. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/528/head:github-bot/gh-528'
git switch 'github-bot/gh-528'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-528'
git switch 'github-bot/gh-528'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-528'
git switch 'github-bot/gh-528'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-528'
git switch 'main'
git merge --squash 'github-bot/gh-528'
git switch 'main'
git merge --ff-only 'github-bot/gh-528'
git switch 'main'
git merge 'github-bot/gh-528'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.