loader: close the unix gate on the last-resort exit path #64

Manually merged
github merged 2 commits from github-bot/gh-64 into gh-pr/64/base 2026-12-01 09:37:23 +00:00 AGit
Owner

@⁠TheRifai on GitHub · 2026-12-01 09:25 UTC · original
TheRifai:loader-end-gate → main · +39 −7 · 4 files · 2 commits · merged 2026-12-01 09:36 UTC

What

Issue #60 / TASKS "Every exit closes the unix gate first": end_process (the loader's 5 s detach-deadline exit) called TerminateProcess without closing the Unix-call gate, so Wine could forcibly unwind a thread inside a unix call and Rust aborted with panic in a function that cannot unwind from vkback_unix::live_done on top of the real cause.

  • victory_gpu::unixgate::close_no_alloc(): sets the refusal flag and waits for INSIDE to drain with only atomics, a clock read and sleeps — no logging, heap or lock (required on that path).
  • victory_loader::before_end_process(f) stores a fn() in a OnceLock; end_process invokes it before TerminateProcess.
  • apps/victory/src/run.rs registers close_no_alloc next to the existing before_threads_end(close).
  • Updated the unixgate.rs module doc: only a crash of our own code remains uncovered.

Evidence and limits

  • tools/build.sh (diagnostics profile) compiles.
  • A 70 s house run reached the world and was clean (no teardown abort).
  • The detach-deadline path itself is not exercised by that run (it needs a detach hang), so the PR does not claim a before/after of the panic. It was observed in an earlier exit-1 run as a secondary abort (issue #60), not the initiating event.
**@⁠TheRifai** on GitHub · 2026-12-01 09:25 UTC · [original](https://github.com/vktory6/VKtory/pull/64) `TheRifai:loader-end-gate` → `main` · +39 −7 · 4 files · 2 commits · merged 2026-12-01 09:36 UTC ## What Issue #60 / TASKS "Every exit closes the unix gate first": `end_process` (the loader's 5 s detach-deadline exit) called `TerminateProcess` without closing the Unix-call gate, so Wine could forcibly unwind a thread inside a unix call and Rust aborted with `panic in a function that cannot unwind` from `vkback_unix::live_done` on top of the real cause. - `victory_gpu::unixgate::close_no_alloc()`: sets the refusal flag and waits for `INSIDE` to drain with only atomics, a clock read and sleeps — no logging, heap or lock (required on that path). - `victory_loader::before_end_process(f)` stores a `fn()` in a `OnceLock`; `end_process` invokes it before `TerminateProcess`. - `apps/victory/src/run.rs` registers `close_no_alloc` next to the existing `before_threads_end(close)`. - Updated the `unixgate.rs` module doc: only a crash of our own code remains uncovered. ## Evidence and limits - `tools/build.sh` (diagnostics profile) compiles. - A 70 s house run reached the world and was clean (no teardown abort). - The detach-deadline path itself is not exercised by that run (it needs a detach hang), so the PR does not claim a before/after of the panic. It was observed in an earlier exit-1 run as a **secondary** abort (issue #60), not the initiating event.
The detach-deadline end_process called TerminateProcess without closing the
unixgate, so Wine could unwind a thread inside a unix call and Rust aborted with
'panic in a function that cannot unwind' (issue #60).

Add unixgate::close_no_alloc (atomics plus clock/sleep only, no logging heap or
locks), a loader hook stored in a OnceLock<fn()>, and register it in run.rs next
to before_threads_end. end_process calls the hook before TerminateProcess.

tools/build.sh compiles; a 70 s house run reached the world and had no abort.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 09:26:38 +00:00
github-bot changed target branch from main to gh-pr/64/base 2026-12-01 09:37:22 +00:00
github manually merged commit 98d7371f74 into gh-pr/64/base 2026-12-01 09:37:23 +00:00
Author
Owner

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

Merged, thanks! Atomics, the clock and sleeps only is what end_process allows, and the OnceLock read is lock-free once set. One commit of mine on top (98d7371): close and close_no_alloc share one drain loop instead of two copies.

Check on the reference system (RX 9070 XT): the PE build, tests and policy pass, and the house-scene validation run shows no new error. The task now names only what is left: a crash of our own code.

**@⁠vktory6** on GitHub · 2026-12-01 09:37 UTC · [original](https://github.com/vktory6/VKtory/pull/64#issuecomment-7306957882) Merged, thanks! Atomics, the clock and sleeps only is what `end_process` allows, and the `OnceLock` read is lock-free once set. One commit of mine on top (98d7371): `close` and `close_no_alloc` share one drain loop instead of two copies. Check on the reference system (RX 9070 XT): the PE build, tests and policy pass, and the house-scene validation run shows no new error. The task now names only what is left: a crash of our own code.
This discussion has been locked. Commenting is limited to contributors.
No description provided.