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

Closed
pes7 wants to merge 1 commit from upstream-pr/2933 into main
pes7 commented 2026-11-26 00:30:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pes7 on 2026-11-26T00:30:49Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6616703019 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2933). Originally posted by [pes7](https://github.com/pes7) on 2026-11-26T00:30:49Z. --- 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.
kotekompotek commented 2026-11-26 01:04:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T00:33:05Z.


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.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7178872912 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7178872912). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T00:33:05Z. --- 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.)
fuzeofficlal commented 2026-11-26 01:04:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:41:25Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179015688 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7179015688). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:41:25Z. --- 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.
Marvisak commented 2026-11-26 02:06:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T01:14:37Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179576790 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7179576790). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T01:14:37Z. --- <!-- 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)_
upstream-sync closed this pull request 2026-11-26 14:01:25 +00:00
pes7 commented 2026-11-26 14:01:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pes7 on 2026-11-26T13:34:46Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7193545665 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2933#issuecomment-7193545665). Originally posted by [pes7](https://github.com/pes7) on 2026-11-26T13:34:46Z. --- Superseded: main already has this guard (219878a0, esource::alias_source), so a rebase leaves no diff. Closing.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2931
No description provided.