HLE: a title's ExitProcess is logged as its exit is #2887
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2887
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2887"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@0xkn0wh3r3 on GitHub · 2026-11-25 23:05 UTC · original
0xkn0wh3r3:hle/exit-process-logged-like-exit→main· +82 −1 · 4 files · 2 commits · openWhat
The title's
exit,abort,terminateandTerminateProcess(of itself) go through exports of ours that log the call and its caller.ExitProcesswas bound to the host's kernel32 one instead, so a title that ended the process that way left no log line.It now has an HLE export that logs the code and the caller, then does what Windows'
ExitProcessdoes. The other threads end and the title images getDLL_PROCESS_DETACH, through the loader'sdetach_all, the same step the CRTexitpath runs from its exit table. Then the host'sExitProcessends the process with the title's code. It deliberately doesn't go through the CRT'sexit. That would run the exit table on the calling thread while the title's other threads are still alive, and an exit function that wants a lock another thread holds would hang there.Where it came from
From DexNom's fork, DexNom/VIctory@570a941: the kernel module's
ExitProcessand the resolver test. It logs with this tree'stracing::warn!(code, from, …)style, likeexithere. Credited withCo-authored-by: DexNom. The detach step and the order test were added in review.Tested
tests::exit_process_resolves_to_hle:ExitProcessfrom kernel32, kernelbase and the processthreads API set resolves to the HLE export. Without the export the test fails (left: Some(Host), right: Some(Hle)).modules::kernel::tests::a_title_exit_process_detaches_then_ends_with_its_code: stand-ins for the two steps record that the title images detach before the exit, and that the exit gets the title's code. No process is spawned or ended.cargo test -p victory-hle -p victory-loader --lib: all pass. Windows 11.cargo clippy -p victory-hle -p victory-loader --all-targets -- -D warnings, with and withoutvictory-hle/diagnostics: clean.Not tested
ExitProcessdirectly.detach_alltheexitpath already uses.@cloph-dsp on GitHub · 2026-11-25 23:16 UTC · original
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
git diff --checkagainst merge-base842b0cbis clean; 2 files, +97/-0.cargo test --locked -p victory-hle --lib -- tests::exit_process_resolves_to_hle --exact --quiet-> 1 passed.cargo test --locked -p victory-hle --lib -- modules::kernel::tests::a_title_exit_process_ends_as_windows_does_with_its_code --exact --quiet-> 1 passed (the child-process test completed in 0.06 s; no hang).cargo test --locked -p victory-hle --quiet-> 154 passed, 0 failed, plus doctests.AI-assisted (Hy4 flash).
@Marvisak on GitHub · 2026-11-26 04:27 UTC · original · edited 2026-11-26 07:23 UTC
Automated triage for the maintainers.
Thanks for
ebd1d10; both points are addressed. The HLEExitProcess(victory-hle/src/modules/kernel.rs) now logs, then runs the loader'sdetach_allthrough the newvictory_loader::detach_for_exit_process. That ends the other threads and sendsDLL_PROCESS_DETACHto the title images, then the host'sExitProcessends the process. This follows the documented Windows order and runs no exit table.detach_allclearsattachedfirst, so a later run through the CRT'satexitdoes nothing. The new test checks the order with stand-ins and spawns no process.CI: passing.
Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 07:00 UTC · original
Both points addressed in
ebd1d10:ExitProcessruns the loader'sdetach_allbefore the host'sExitProcess, exposed asvictory_loader::detach_for_exit_process. As on Windows, the other threads end and the title images getDLL_PROCESS_DETACH, in the same order theexitpath gives them; then the process ends with the title's code. Still no exit functions run.a_title_exit_process_detaches_then_ends_with_its_codechecks the steps with stand-ins (detach first, then exit with the title's code) without spawning or ending a process. The PR description is updated to match.@fuzeofficlal on GitHub · 2026-11-25 23:31 UTC · original · reviewed
Verified head
13422588cleanly merged ontoorigin/main(842b0cb7) on Windows 11 x64.Code Review
ExitProcessincrates/victory-hle/src/modules/kernel.rslogs both the rawu32exit code andhost::callers()before forwarding directly to Win32ExitProcess(code)(avoiding CRTexit()/atexitlock hazards when a title exits with other threads active).a_title_exit_process_ends_as_windows_does_with_its_code) is properly gated behindVICTORY_TEST_EXIT_PROCESS_CHILDwith--exactand a 30s timeout safeguard (completes in ~0.5s locally) and validates high-bit exit code preservation (0x8765_4321).Local Verification
cargo test --locked -p victory-hle: 154/154 unit tests passed (includingtests::exit_process_resolves_to_hleandmodules::kernel::tests::a_title_exit_process_ends_as_windows_does_with_its_code), plusfidelityfx(1/1) andno_dll_planting(1/1).cargo clippy --locked -p victory-hle --all-targets -- -D warnings(default and--all-features): clean.cargo xtask policy:191 files ok.Looks clean and ready to merge.
@kotekompotek on GitHub · 2026-11-25 23:35 UTC · original · reviewed
Right: the title's ExitProcess was bound to the host's silently, losing the exit diagnostic — and deliberately calling host::exit_process rather than CRT exit avoids the exit-table hang when other threads hold locks (Windows itself kills threads before running atexit). The resolver test pins HLE provenance for all three spellings. LGTM.
@Dukestar69 on GitHub · 2026-11-26 17:51 UTC · original · approved these changes
Reviewed and verified locally on Windows 11 x64:
cargo test -p victory-loader --lib threads:: -- --test-threads=1: 2 passed, 0 failed.cargo test -p victory-hle --lib modules::kernel:: -- --test-threads=1: 6 passed, 0 failed (includinga_title_exit_process_detaches_then_ends_with_its_code).cargo clippy -p victory-loader -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@futurepro62 on GitHub · 2026-11-26 18:06 UTC · original
NVIDIA full-suite run, to go with the reports above by Dukestar69, cloph-dsp, since none of them names a GPU run. Tested exact head
ebd1d10(on its base842b0cb).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.exit_process_resolves_to_hle,a_title_exit_process_detaches_then_ends_with_its_code.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.