test(libkernel): run guest_exception_fault with ASan's SEGV handler off #16070

Merged
xXPBSXx merged 1 commit from upstream-pr/16070 into main 2026-11-10 05:08:39 +00:00
xXPBSXx commented 2026-11-05 14:28:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-05T14:28:00Z.


What

guest_exception_fault fails in the nightly Sanitizers run of 2026-11-05 (run 41963336767), the first nightly after #7192 (merged 2026-11-04 19:19 UTC) added it: the test ends with Subprocess aborted, and its output carries AddressSanitizer: SEGV on unknown address 0x000000000010.

TestRemoveAndReturn starts the test program again as a child. The child installs a handler, the handler removes itself, and the child then reads address 0x10, which faults. The parent requires the child to die by SIGSEGV (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV, GuestExceptionFault.cpp:558). Once the handler is gone, ChainFault (Exception.cpp:1231-1247) passes the fault to the previously installed handler. Under ASan that is ASan's own SEGV handler, which prints its report and exits with code 1, so the child does not die by a signal and the check fails.

This PR adds add_asan_test_options(guest_exception_fault handle_segv=0) after the test's TIMEOUT line in core/libs/prx/libkernel/CMakeLists.txt. In ASan builds ASan then does not install its SEGV handler for this test, and the child dies by SIGSEGV as the test expects. The consequence, stated plainly: ASan does not report a SEGV inside this one test. Its other checks and every other test stay as they are, and nothing changes outside ASan builds. The helper is the one that already sets detect_stack_use_after_return=0 for neighbouring tests; there is no earlier use of handle_segv.

The other tests that expect a child to die by SIGSEGV or SIGBUS (WriteWatch.cpp, WriteWatchBacking.cpp, GuestArenaHost.cpp) are only registered if(APPLE) (core/libs/CMakeLists.txt:631-634), so no other Linux test hits this. I did not take two other routes. Skipping the check under ANYPS5_ENABLE_ASAN, as GuestGetrlimit.cpp does for one of its tests, would drop the check from the sanitizer job. Changing ChainFault is not needed for this failure, and I left Exception.cpp alone.

Tested

Ubuntu 24.04, GCC 13.3, ASan + UBSan configured as in sanitizers.yml, ASAN_OPTIONS=detect_leaks=0, on main e772fb25cc72ee5faf77847f06bbc69533016e82:

  • Before the change, on 2026-11-05 from 12:06 UTC to 12:11 UTC: guest_exception_fault failed in 3 of 3 runs (Subprocess aborted). Running the child directly (guest_exception_fault_tests remove-and-return) exited with 1 and printed AddressSanitizer: SEGV on unknown address 0x000000000010; with ASAN_OPTIONS=detect_leaks=0:handle_segv=0 it exited with 139 (SIGSEGV) and the test passed in 3 of 3 runs.
  • With the change, on 2026-11-05 from 12:18 UTC to 12:20 UTC: Passed in 3 of 3 runs, and ctest lists the environment modification for the test.
  • libkernel/CMakeLists.txt from main (red): Subprocess aborted in 3 of 3 runs.
  • Change restored: Passed in 3 of 3 runs. cmake and ninja exited 0 in every arm.
  • python -I tools/check_conventions.py --base e772fb25cc72ee5faf77847f06bbc69533016e82 passed; git diff --check is clean.

Not run: Windows and macOS. The helper only acts when ANYPS5_ENABLE_ASAN is on, which the build allows on Linux only.

Overlap

Checked against main e772fb25cc with the 1815 open PRs listed at 12:19 UTC on 2026-11-05 (scan from 12:17 UTC to 13:24 UTC); the changed files of each PR come from git diff --name-only against its merge base. 47 PRs change core/libs/prx/libkernel/CMakeLists.txt and none changes core/libs/tests/GuestExceptionFault.cpp. Measured against this head with git merge-tree: 29 are clean. The other 18 also conflict with main alone, so this PR does not cause any of them. No open PR mentions guest_exception_fault, handle_segv or ChainFault, and #7192 has no open follow-up. The branch is based on e772fb25cc; against current main d23df92b3805fea21493a73cbed8835c9e8548d0 (checked on 2026-11-05 at 13:26 UTC) it merges cleanly. None of the pull requests opened after that listing, up to 14:25 UTC, changes either file. Depends on: none.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5173207445 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16070). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-11-05T14:28:00Z. --- ### What `guest_exception_fault` fails in the nightly Sanitizers run of 2026-11-05 (run 41963336767), the first nightly after #7192 (merged 2026-11-04 19:19 UTC) added it: the test ends with `Subprocess aborted`, and its output carries `AddressSanitizer: SEGV on unknown address 0x000000000010`. `TestRemoveAndReturn` starts the test program again as a child. The child installs a handler, the handler removes itself, and the child then reads address `0x10`, which faults. The parent requires the child to die by `SIGSEGV` (`WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV`, `GuestExceptionFault.cpp:558`). Once the handler is gone, `ChainFault` (`Exception.cpp:1231-1247`) passes the fault to the previously installed handler. Under ASan that is ASan's own SEGV handler, which prints its report and exits with code 1, so the child does not die by a signal and the check fails. This PR adds `add_asan_test_options(guest_exception_fault handle_segv=0)` after the test's `TIMEOUT` line in `core/libs/prx/libkernel/CMakeLists.txt`. In ASan builds ASan then does not install its SEGV handler for this test, and the child dies by `SIGSEGV` as the test expects. The consequence, stated plainly: ASan does not report a SEGV inside this one test. Its other checks and every other test stay as they are, and nothing changes outside ASan builds. The helper is the one that already sets `detect_stack_use_after_return=0` for neighbouring tests; there is no earlier use of `handle_segv`. The other tests that expect a child to die by `SIGSEGV` or `SIGBUS` (`WriteWatch.cpp`, `WriteWatchBacking.cpp`, `GuestArenaHost.cpp`) are only registered `if(APPLE)` (`core/libs/CMakeLists.txt:631-634`), so no other Linux test hits this. I did not take two other routes. Skipping the check under `ANYPS5_ENABLE_ASAN`, as `GuestGetrlimit.cpp` does for one of its tests, would drop the check from the sanitizer job. Changing `ChainFault` is not needed for this failure, and I left `Exception.cpp` alone. ### Tested Ubuntu 24.04, GCC 13.3, ASan + UBSan configured as in `sanitizers.yml`, `ASAN_OPTIONS=detect_leaks=0`, on `main` `e772fb25cc72ee5faf77847f06bbc69533016e82`: - Before the change, on 2026-11-05 from 12:06 UTC to 12:11 UTC: `guest_exception_fault` failed in 3 of 3 runs (`Subprocess aborted`). Running the child directly (`guest_exception_fault_tests remove-and-return`) exited with 1 and printed `AddressSanitizer: SEGV on unknown address 0x000000000010`; with `ASAN_OPTIONS=detect_leaks=0:handle_segv=0` it exited with 139 (`SIGSEGV`) and the test passed in 3 of 3 runs. - With the change, on 2026-11-05 from 12:18 UTC to 12:20 UTC: Passed in 3 of 3 runs, and `ctest` lists the environment modification for the test. - `libkernel/CMakeLists.txt` from main (red): `Subprocess aborted` in 3 of 3 runs. - Change restored: Passed in 3 of 3 runs. cmake and ninja exited 0 in every arm. - `python -I tools/check_conventions.py --base e772fb25cc72ee5faf77847f06bbc69533016e82` passed; `git diff --check` is clean. Not run: Windows and macOS. The helper only acts when `ANYPS5_ENABLE_ASAN` is on, which the build allows on Linux only. ### Overlap Checked against main e772fb25cc72ee5faf77847f06bbc69533016e82 with the 1815 open PRs listed at 12:19 UTC on 2026-11-05 (scan from 12:17 UTC to 13:24 UTC); the changed files of each PR come from `git diff --name-only` against its merge base. 47 PRs change `core/libs/prx/libkernel/CMakeLists.txt` and none changes `core/libs/tests/GuestExceptionFault.cpp`. Measured against this head with `git merge-tree`: 29 are clean. The other 18 also conflict with main alone, so this PR does not cause any of them. No open PR mentions `guest_exception_fault`, `handle_segv` or `ChainFault`, and #7192 has no open follow-up. The branch is based on `e772fb25cc`; against current main `d23df92b3805fea21493a73cbed8835c9e8548d0` (checked on 2026-11-05 at 13:26 UTC) it merges cleanly. None of the pull requests opened after that listing, up to 14:25 UTC, changes either file. Depends on: none. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
boykopovar/AnyPS5!16070
No description provided.