test(libSceLibcInternal): let the spawn test's child die from SIGBUS in an ASan build #11239

Merged
MarcZX10 merged 1 commit from upstream-pr/11239 into main 2026-10-26 07:39:21 +00:00
MarcZX10 commented 2026-10-25 22:27:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:27:44Z.


What

guest_posix_spawn (added in #9133) checks that waitpid reports a child killed by a signal. For that, the spawned child raises SIGBUS itself (child-kill-bus, GuestPosixSpawn.cpp:340). In an ANYPS5_ENABLE_ASAN build the child is instrumented too, and AddressSanitizer handles SIGBUS by default (handle_sigbus=1). It reports AddressSanitizer: BUS on unknown address ... in pthread_kill and aborts, so the parent sees a different signal and fails Posix spawn check failed at line 311 ((status & 0x7f) == guestSignal).

add_asan_test_options(guest_posix_spawn handle_sigbus=0) adds the option to the test's ASAN_OPTIONS, as other tests already do for detect_stack_use_after_return and verify_asan_link_order. The child inherits the parent's environment, so its deliberate SIGBUS kills it as intended. The option only exists in ASan builds; other builds are unchanged. ASan still reports real faults through SIGSEGV there.

Tested

On an ubuntu-latest fork runner:

  • -DANYPS5_ENABLE_ASAN=ON Debug build, ASAN_OPTIONS=detect_leaks=0: guest_posix_spawn passes with this change. With the CMake file restored from main, it fails with SUMMARY: AddressSanitizer: BUS ... in pthread_kill and Posix spawn check failed at line 311, as in a full ASan and UBSan run of the tree.
  • RelWithDebInfo build without sanitizers: guest_posix_spawn passes.
  • python3 tools/check_conventions.py --base upstream/main and git diff --check upstream/main pass, and tools/pr_overlap.py --branch reports no conflicting lines. Windows and macOS were not run; the option applies only to the Linux ASan build.

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 (not applicable; no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5009349175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11239). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T22:27:44Z. --- ### What `guest_posix_spawn` (added in #9133) checks that `waitpid` reports a child killed by a signal. For that, the spawned child raises `SIGBUS` itself (`child-kill-bus`, `GuestPosixSpawn.cpp:340`). In an `ANYPS5_ENABLE_ASAN` build the child is instrumented too, and AddressSanitizer handles `SIGBUS` by default (`handle_sigbus=1`). It reports `AddressSanitizer: BUS on unknown address ... in pthread_kill` and aborts, so the parent sees a different signal and fails `Posix spawn check failed at line 311` (`(status & 0x7f) == guestSignal`). `add_asan_test_options(guest_posix_spawn handle_sigbus=0)` adds the option to the test's `ASAN_OPTIONS`, as other tests already do for `detect_stack_use_after_return` and `verify_asan_link_order`. The child inherits the parent's environment, so its deliberate `SIGBUS` kills it as intended. The option only exists in ASan builds; other builds are unchanged. ASan still reports real faults through `SIGSEGV` there. ### Tested On an `ubuntu-latest` fork runner: - `-DANYPS5_ENABLE_ASAN=ON` Debug build, `ASAN_OPTIONS=detect_leaks=0`: `guest_posix_spawn` passes with this change. With the CMake file restored from `main`, it fails with `SUMMARY: AddressSanitizer: BUS ... in pthread_kill` and `Posix spawn check failed at line 311`, as in a full ASan and UBSan run of the tree. - RelWithDebInfo build without sanitizers: `guest_posix_spawn` passes. - `python3 tools/check_conventions.py --base upstream/main` and `git diff --check upstream/main` pass, and `tools/pr_overlap.py --branch` reports no conflicting lines. Windows and macOS were not run; the option applies only to the Linux ASan build. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 (not applicable; no third-party code added) - [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
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!11239
No description provided.