Skip to content

runtime: raise SIGABRT from the guest abort() handler - #3928

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
sds-228:abort-sigabrt-handler
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
sds-228:abort-sigabrt-handler

Conversation

@sds-228

@sds-228 sds-228 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: the free RT item released by @kotorvr (claim).

What and why

game_abort() recorded exit code 3 without giving the guest's SIGABRT handler a chance to run. The guest's signal() import binds to the host CRT, so std::signal/std::raise on that table reproduce the native ordering: raise only when a handler is installed, then keep gta6rt's code 3 for the default, ignored and returning-handler cases so the host process is never terminated.

A synthetic fixture now has handler, exit()-from-handler, returning-handler, ignore and default abort modes. A new test compares native and mapped exit codes for each one; current UCRT fail-fasts with 0xC0000409 for the three non-exiting cases, which is recorded as an intentional difference from gta6rt's code 3. docs/runtime_imports.md states the new behaviour.

Tested

  • ctest -R "^run_tiny_game": 9/9 passed, including the new run_tiny_game_abort_exit_codes (10/10 native/mapped exit-code checks in that test).
  • Full ctest on this branch: 134/134 passed, 0 failed (9 skipped, 1 disabled).
  • Negative control: with only process.cpp reverted to main, gta6rt abort-handler exits 3 instead of 43 and the new test fails; the other nine checks still pass. Restoring the fix makes all ten pass.
  • Windows, MSVC 19.44, RelWithDebInfo; CPU only, no game files or GPU.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not a translator change.)

AI-assisted (OpenCode).

…talled

game_abort() ended the run directly, so a title's own SIGABRT handler never ran. Raise SIGABRT only when a handler is registered (the guest's signal() import binds to the host CRT), leaving the default and ignored cases ending with code 3 so the host is never killed. Add a synthetic fixture with handler, returning-handler, ignore and default modes plus a native-vs-loader exit-code test.

AI-assisted (OpenCode)

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested b2e888f5 on Windows 11, MSVC 19.44.35228 + Ninja, RelWithDebInfo.

  • Built gta6rt, the tiny_game fixture and tiny_game_abort_test (36/36 steps).
  • ctest -R tiny_game_abort --output-on-failure -> 1/1 passed, 1.14 s.
  • The verbose run shows the default/no-handler controls keeping exit 3, and the handler modes running the guest's SIGABRT path before the normal shutdown; the FAIL lines in the verbose log are the deliberate no-shim control run, not test failures (the ctest verdict is green).

The change reproduces the native ordering (raise only when a handler is installed, then keep code 3 for the default/ignored case), which is what the guest CRT would do. No game files; no blocker.

@Ayinaki

Ayinaki commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested b2e888f5 on NVIDIA GeForce RTX 5070 (driver 616.86), Windows 11 build 26200, MSVC RelWithDebInfo: pass.

  • Built gta6rt, tiny_game and tiny_game_abort_test, then ctest -R run_tiny_game_abort_exit_codes: Passed (4.00 s). The native and mapped exit codes agree for every abort mode the fixture covers.
  • The rest of the run_tiny_game_* suite was not run; this was the new test only.

@AirKyzzZ

Copy link
Copy Markdown
Contributor

Tested b2e888f5 on RTX 2060, NVIDIA 566.14, Windows 10 22H2 (19045), clang-cl 23.1.6 + SDK 10.0.26100: pass.

ctest -R "^run_tiny_game": 9/9 passed, including run_tiny_game_abort_exit_codes, so the Windows 10 UCRT also fail-fasts with 0xC0000409 on the native default, ignore and returning-handler runs. Full ctest on main aa2988cc + #3925 + #3926 + #3928 merged: 130 passed / 10 skipped, the only failure is d3d12_vulkan_device (line 5124), the known Windows 10 host comparison #3557 fixes, same as on main. Built with clang-cl rather than MSVC, so std::signal in the shim and the guest's signal import go through the same /MD ucrtbase here too. AI-assisted.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Tested b2e888f on Windows 11 (MSVC RelWithDebInfo): full runtime build, then ctest for the shim/loader tests (loader, pe_loader, loader_tls, dll_thread_calls, unimplemented_policy, startup_trace, xmem, process_cmdline, file_system, winhttp_offline, xgameruntime, run_tiny_*, allocator_proxy) — 28 of 28 passed. AI-assisted.

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested b2e888f on Intel UHD 770 (driver 32.0.101.7088), Windows 11, MSVC 19.44, Vulkan SDK 1.4.357.0: pass, with one intermittent failure of run_tiny_game_dir that is not specific to this PR.

  • Native MSVC build of gta6rt, tiny_game and tiny_game_abort_test, ctest -R "^run_tiny_game": the PR's run_tiny_game_abort_exit_codes passes (2.35 sec) in every run, and so do run_tiny_game, _console_paths, _exit_code, _fixed, _fixed_exit_code, _tls and _eh.
  • The first run after a fresh build failed run_tiny_game_dir once ("GAME: did not resolve to the game folder", "--- dot: returned 0"), 89% tests passed, 1 failed out of 9. The same group then passed 9/9 in three more runs.
  • To see whether the PR causes it: after deleting gta6rt.exe and tiny_game.exe and rebuilding, ctest -R "^run_tiny_game_dir$" --repeat until-fail:10 passed 10/10 twice on b2e888f (20/20) and 10/10 twice on main 3faac55 (20/20). It did not reproduce on either, so I can say only that it appears rarely on the first run after a build and is not tied to this change.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants