victory-gpu: a view of no resource is not looked up as an alias (null dereference that ends every run after the account screen) #2933

Closed
github-bot wants to merge 1 commit from github-bot/gh-2933 into main AGit
Owner

@⁠pes7 on GitHub · 2026-11-26 00:30 UTC · original
pes7:fix/null-alias-source → main · +5 −0 · 1 files · 1 commits · closed without merging

The title binds a shader-visible descriptor whose resource is null, and a draw's table then asks resource::alias_source about it. The function went straight to resource(placed) and read the description of the null one: an access violation at 0x30 (null plus the field's offset), which took the whole run down about a minute after the title leaves the account screen, every time. Symbolised from the crash log's offsets against victory.pdb:

#0 resource::alias_source::closure$1  resource.rs:1797  (read 0x30: nothing mapped there)
#1 resource::alias_source             resource.rs:1802
#2 draw::readable                     draw.rs:1897
#3 draw::State::table_entry           draw.rs:1222
#4 draw::State::tables                draw.rs:1263
#5 draw::State::bind                  draw.rs:644
#6 draw::State::execute_indirect      draw.rs:1761

The registers agree (rax 0x0). Its neighbours already do this — resource::host_resource and resource::host_copy return None for a null handle — this is the one that did not.

With the guard the fault is gone: the same run now ends in the known GPU device removal instead of the title's own crash handler, which is where the next piece of work is.

Found by building --features diagnostics (which keeps debug info in the release profile), running the title, and resolving the offsets the crash log prints with llvm-symbolizer --relative-address --obj=target/release/victory.exe.

cargo test --release -p victory-gpu: 195 pass.

**@⁠pes7** on GitHub · 2026-11-26 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2933) `pes7:fix/null-alias-source` → `main` · +5 −0 · 1 files · 1 commits · closed without merging The title binds a shader-visible descriptor whose resource is null, and a draw's table then asks `resource::alias_source` about it. The function went straight to `resource(placed)` and read the description of the null one: an access violation **at 0x30** (null plus the field's offset), which took the whole run down about a minute after the title leaves the account screen, every time. Symbolised from the crash log's offsets against `victory.pdb`: ``` #0 resource::alias_source::closure$1 resource.rs:1797 (read 0x30: nothing mapped there) #1 resource::alias_source resource.rs:1802 #2 draw::readable draw.rs:1897 #3 draw::State::table_entry draw.rs:1222 #4 draw::State::tables draw.rs:1263 #5 draw::State::bind draw.rs:644 #6 draw::State::execute_indirect draw.rs:1761 ``` The registers agree (`rax 0x0`). Its neighbours already do this — `resource::host_resource` and `resource::host_copy` return `None` for a null handle — this is the one that did not. With the guard the fault is gone: the same run now ends in the known GPU device removal instead of the title's own crash handler, which is where the next piece of work is. Found by building `--features diagnostics` (which keeps debug info in the release profile), running the title, and resolving the offsets the crash log prints with `llvm-symbolizer --relative-address --obj=target/release/victory.exe`. `cargo test --release -p victory-gpu`: 195 pass.
The title binds a shader-visible descriptor whose resource is null, and a
draw's table then asks `resource::alias_source` about it: the function went
straight to `resource(placed)` and read the description of the null one -
an access violation at 0x30 (null plus the field's offset), which took the
whole run down about a minute after the title leaves the account screen:

    #0 resource::alias_source::closure$1  resource.rs:1797  (read 0x30)
    #1 resource::alias_source             resource.rs:1802
    #2 draw::readable                     draw.rs:1897
    #3 draw::State::table_entry           draw.rs:1222
    #4 draw::State::tables                draw.rs:1263
    #5 draw::State::bind                  draw.rs:644
    #6 draw::State::execute_indirect      draw.rs:1761

Its neighbours (`resource::host_resource`, `resource::host_copy`) already
return `None` for a null handle; this is the one that did not.

Found by running the title with `target\release\victory.pdb` and
`llvm-symbolizer --relative-address` on the offsets the crash log prints.
With the guard the fault is gone (the same run now ends in the known
GPU device removal instead, not in the title's own handler).

cargo build --release -p victory --features diagnostics.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:50 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 00:33 UTC · original

Heads-up: this guard already landed on main — alias_source at resource.rs:1790 now reads

// A shader view of no resource (a null view) has no memory.
if placed.is_null() {
    return None;
}

from the earlier merge of the same fix for issue #2847's crash class ("GPU: a null shader view has no alias source", 219878a). This PR is functionally identical to what's already in — rebase would leave it empty. Issue #2852 reported the same signature and was pointed at a main retest for the same reason.

(Matching independently: the call site draw.rs checks *b != 0 for its own read, so this alias_source guard is the only place a null view was still dereferenced — the fix is complete there.)

**@⁠kotekompotek** on GitHub · 2026-11-26 00:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7178872912) Heads-up: this guard already landed on main — `alias_source` at `resource.rs:1790` now reads ```rust // A shader view of no resource (a null view) has no memory. if placed.is_null() { return None; } ``` from the earlier merge of the same fix for issue #2847's crash class ("GPU: a null shader view has no alias source", `219878a`). This PR is functionally identical to what's already in — rebase would leave it empty. Issue #2852 reported the same signature and was pointed at a main retest for the same reason. (Matching independently: the call site `draw.rs` checks `*b != 0` for its own read, so this `alias_source` guard is the only place a null view was still dereferenced — the fix is complete there.)
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:41 UTC · original

Heads-up from checking head eca1d364a223 against current main (63bcca43c6a0):

  • crates/victory-gpu/src/resource.rs currently conflicts with main, because commit 219878a0e775 (GPU: a null shader view has no alias source) already landed the same if placed.is_null() { return None; } guard in alias_source along with the unit test resource::tests::a_null_view_has_no_alias_source.
  • Audited all sibling lookup paths on main: alias_source is only called from draw.rs View::Shader (placed_texture / readable), host_resource / made_copy / host_copy already return None for null this, and View::Unordered does not go through alias_source.
  • For completeness, PR head eca1d364a223 itself passes cargo xtask policy (184 files ok), clippy (default + --features diagnostics, 0 warnings), and resource::tests draw::tests 28/28 on both RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1).

Since 219878a0e775 already covers this exact guard on main, this PR looks safe to close as superseded.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7179015688) Heads-up from checking head `eca1d364a223` against current `main` (`63bcca43c6a0`): - `crates/victory-gpu/src/resource.rs` currently conflicts with `main`, because commit `219878a0e775` (`GPU: a null shader view has no alias source`) already landed the same `if placed.is_null() { return None; }` guard in `alias_source` along with the unit test `resource::tests::a_null_view_has_no_alias_source`. - Audited all sibling lookup paths on `main`: `alias_source` is only called from `draw.rs` `View::Shader` (`placed_texture` / `readable`), `host_resource` / `made_copy` / `host_copy` already return `None` for null `this`, and `View::Unordered` does not go through `alias_source`. - For completeness, PR head `eca1d364a223` itself passes `cargo xtask policy` (`184 files ok`), `clippy` (default + `--features diagnostics`, 0 warnings), and `resource::tests draw::tests` 28/28 on both RTX 5090 and WARP (`VICTORY_D3D12_DEBUG=1`). Since `219878a0e775` already covers this exact guard on `main`, this PR looks safe to close as superseded.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 01:14 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/resource.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 01:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7179576790) <!-- victory-triage v1 head=eca1d364a2239dd9d500c680f09e8fd2a88dafaa verdict=needs-rebase at=2026-11-26T01:14:36Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-gpu/src/resource.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot closed this pull request 2026-11-26 13:36:19 +00:00
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 13:34 UTC · original

Superseded: main already has this guard (219878a0,
esource::alias_source), so a rebase leaves no diff. Closing.

**@⁠pes7** on GitHub · 2026-11-26 13:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7193545665) Superseded: main already has this guard (219878a0, esource::alias_source), so a rebase leaves no diff. Closing.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2933
No description provided.