Exit paths skipping unixgate::close abort in vkback_unix::live_done #60

Open
opened 2026-12-01 09:10:33 +00:00 by github-bot · 1 comment
Owner

@⁠TheRifai on GitHub · 2026-12-01 09:09 UTC · original

Finding (AGENTS.md rule 29)

crates/victory-gpu/src/unixgate.rs documents that every process exit must call unixgate::close() before other threads end, or a thread inside a unix call is forcibly unwound by Wine into an extern "C" entry and Rust aborts (panic in a function that cannot unwind). It lists the paths covered today and two that are not covered: the loader's end_process after the 5 s detach deadline (crates/victory-loader/src/threads.rs) and a crash of our own code.

I observed that secondary abort in a local exit-1 investigation: a native LD_PRELOAD exit tracer caught abort with the frames core::panicking::panic_cannot_unwind <- vkback_unix::live_done <- __wine_unix_call_dispatcher (addresses mapped with addr2line against the installed libvkback_unix.so and Proton's ntdll.so). It was not the initiating exit — the title had already decided to stop — but it obscures the original failure with an abort at teardown.

Why a ticket

  • The gate's covered paths are spread across apps/victory/src/run.rs:58, crates/victory-hle/src/modules/kernel.rs (three sites), lifecycle.rs, and (per the module doc) d3d12x.rs. Any new exit path or a fork that drops the hook reintroduces the abort. For example, Skrills68/Valhalla-xmem's apps/victory/src/run.rs removes the before_threads_end(unixgate::close) line entirely.
  • end_process cannot take locks or the heap, so simply calling close() there is not currently possible; that gap is still open.

Next

Either make end_process close the gate with atomics only (set a refusal flag and wait for INSIDE to drain without locks/heap), or move the gate close earlier in the loader shutdown. Add a note to docs/tools.md for the LD_PRELOAD native-exit trace that found this. A regression check would be useful: a run ended through the detach deadline should not print panic in a function that cannot unwind.

Seen on: f4dc80f (and earlier diagnostic builds).

**@⁠TheRifai** on GitHub · 2026-12-01 09:09 UTC · [original](https://github.com/vktory6/VKtory/issues/60) ## Finding (AGENTS.md rule 29) `crates/victory-gpu/src/unixgate.rs` documents that every process exit must call `unixgate::close()` before other threads end, or a thread inside a unix call is forcibly unwound by Wine into an `extern "C"` entry and Rust aborts (`panic in a function that cannot unwind`). It lists the paths covered today and two that are **not** covered: the loader's `end_process` after the 5 s detach deadline (`crates/victory-loader/src/threads.rs`) and a crash of our own code. I observed that secondary abort in a local exit-1 investigation: a native `LD_PRELOAD` exit tracer caught `abort` with the frames `core::panicking::panic_cannot_unwind` <- `vkback_unix::live_done` <- `__wine_unix_call_dispatcher` (addresses mapped with `addr2line` against the installed `libvkback_unix.so` and Proton's `ntdll.so`). It was not the initiating exit — the title had already decided to stop — but it obscures the original failure with an abort at teardown. ## Why a ticket - The gate's covered paths are spread across `apps/victory/src/run.rs:58`, `crates/victory-hle/src/modules/kernel.rs` (three sites), `lifecycle.rs`, and (per the module doc) `d3d12x.rs`. Any new exit path or a fork that drops the hook reintroduces the abort. For example, `Skrills68/Valhalla-xmem`'s `apps/victory/src/run.rs` removes the `before_threads_end(unixgate::close)` line entirely. - `end_process` cannot take locks or the heap, so simply calling `close()` there is not currently possible; that gap is still open. ## Next Either make `end_process` close the gate with atomics only (set a refusal flag and wait for `INSIDE` to drain without locks/heap), or move the gate close earlier in the loader shutdown. Add a note to `docs/tools.md` for the `LD_PRELOAD` native-exit trace that found this. A regression check would be useful: a run ended through the detach deadline should not print `panic in a function that cannot unwind`. Seen on: `f4dc80f` (and earlier diagnostic builds).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 09:10:34 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 09:15 UTC · original

Thanks! I created a task based on your report: "Every exit closes the unix gate first" in github.com/vktory6/VKtory@e6de2b1, with your two options for end_process and the regression check.

**@⁠vktory6** on GitHub · 2026-12-01 09:15 UTC · [original](https://github.com/vktory6/VKtory/issues/60#issuecomment-7306438524) Thanks! I created a task based on your report: "Every exit closes the unix gate first" in https://github.com/vktory6/VKtory/commit/e6de2b1, with your two options for `end_process` and the regression check.
This discussion has been locked. Commenting is limited to contributors.
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/vktory6--VKtory#60
No description provided.