guest_jxr_bitio aborts on Windows 11 26200: a caller's locals are wrong after an exception crosses attachISWrite #26048

Open
opened 2026-11-23 06:01:42 +00:00 by fin-github · 0 comments
fin-github commented 2026-11-23 06:01:42 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fin-github on 2026-11-23T06:01:42Z.


What happens

guest_jxr_bitio aborts on every run on one Windows machine (Exit code 0xc0000409, 15 of 15 runs) while it passes on the Windows CI job (8ce09de9ef, same WinLibs release):

JXR bit I/O: attachment forwards original stream

Where it goes wrong

RunAttachWrite in core/libs/tests/GuestJxrBitIo.cpp. Under gdb (breakpoint on AttachmentPosition, printing rdi, rsi and attachingStream):

  • The six normal attachISWrite_nid_postfix calls and the throwing call pass stream = 0x5fda70, position = 0x5ffaf8 (&io->referenceOffset), matching attachingStream.
  • The throwing callback's std::invalid_argument propagates out of attachISWrite_nid_postfix and is caught in RequireInvalidArgument.
  • The next call, attachISWrite_nid_postfix(io, &stream) after stream.getPosition = nullptr, still reaches AttachmentPosition, with stream = 0x5ffab0 and position = 0x10028. So &stream and io are wrong after the catch. 0x5ffab0 - 0x5fda70 = 0x2040, about the size of RunAttachWrite's storage array.

So after the exception crosses the System V ABI frames (AttachmentPosition, attachISWrite_nid_postfix, both built with -fno-asynchronous-unwind-tables), the catching frame resumes with a wrong stack or frame pointer.

What it isn't

  • Not #23686 (46abbab7c7): with BitIo.cpp from 46abbab7c7^, 5 of 5 still abort.
  • Not a GPU: identical on both GPUs in full sweeps.
  • No injected DLLs: the process loads only ntdll, kernel32, kernelbase, ucrtbase, SHCore and the build's own libSceJxr.prx, libc.prx, libstdc++-6.dll, libgcc_s_seh-1.dll, libwinpthread-1.dll.
  • User shadow stacks are not enforced (Get-ProcessMitigation -System: UserShadowStack NOTSET).
  • Building BitIo.cpp with -fasynchronous-unwind-tables does not compile (Error: .seh_handlerdata used outside of .seh_proc block), so that path couldn't be tested.

I don't know why CI and other Windows sweeps pass. One difference I can't rule out is the OS build (this machine is 26200; I don't know the runner's).

Title, test or build step

guest_jxr_bitio

AnyPS5 commit

d32e214029 (main)

System

Windows 11 Pro 10.0.26200, AMD Ryzen 5 7600X, 15 GB RAM, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), WinLibs CMake 4.3.1, Ninja 1.13.2, Release, BUILD_TESTING=ON, fresh clone.

Steps to reproduce

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
cmake --build build
ctest --test-dir build -R ^guest_jxr_bitio$ -V

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6553324232 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/26048). Originally posted by [fin-github](https://github.com/fin-github) on 2026-11-23T06:01:42Z. --- ### What happens `guest_jxr_bitio` aborts on every run on one Windows machine (`Exit code 0xc0000409`, 15 of 15 runs) while it passes on the Windows CI job (`8ce09de9ef`, same WinLibs release): ``` JXR bit I/O: attachment forwards original stream ``` ### Where it goes wrong `RunAttachWrite` in `core/libs/tests/GuestJxrBitIo.cpp`. Under gdb (breakpoint on `AttachmentPosition`, printing `rdi`, `rsi` and `attachingStream`): - The six normal `attachISWrite_nid_postfix` calls and the throwing call pass `stream = 0x5fda70`, `position = 0x5ffaf8` (`&io->referenceOffset`), matching `attachingStream`. - The throwing callback's `std::invalid_argument` propagates out of `attachISWrite_nid_postfix` and is caught in `RequireInvalidArgument`. - The next call, `attachISWrite_nid_postfix(io, &stream)` after `stream.getPosition = nullptr`, still reaches `AttachmentPosition`, with `stream = 0x5ffab0` and `position = 0x10028`. So `&stream` and `io` are wrong after the catch. `0x5ffab0 - 0x5fda70 = 0x2040`, about the size of `RunAttachWrite`'s `storage` array. So after the exception crosses the System V ABI frames (`AttachmentPosition`, `attachISWrite_nid_postfix`, both built with `-fno-asynchronous-unwind-tables`), the catching frame resumes with a wrong stack or frame pointer. ### What it isn't - Not #23686 (`46abbab7c7`): with `BitIo.cpp` from `46abbab7c7^`, 5 of 5 still abort. - Not a GPU: identical on both GPUs in full sweeps. - No injected DLLs: the process loads only ntdll, kernel32, kernelbase, ucrtbase, SHCore and the build's own `libSceJxr.prx`, `libc.prx`, `libstdc++-6.dll`, `libgcc_s_seh-1.dll`, `libwinpthread-1.dll`. - User shadow stacks are not enforced (`Get-ProcessMitigation -System`: `UserShadowStack NOTSET`). - Building `BitIo.cpp` with `-fasynchronous-unwind-tables` does not compile (`Error: .seh_handlerdata used outside of .seh_proc block`), so that path couldn't be tested. I don't know why CI and other Windows sweeps pass. One difference I can't rule out is the OS build (this machine is 26200; I don't know the runner's). ### Title, test or build step `guest_jxr_bitio` ### AnyPS5 commit `d32e214029` (main) ### System Windows 11 Pro 10.0.26200, AMD Ryzen 5 7600X, 15 GB RAM, WinLibs GCC 15.2.0 r7 (`x86_64-ucrt-posix-seh`), WinLibs CMake 4.3.1, Ninja 1.13.2, Release, `BUILD_TESTING=ON`, fresh clone. ### Steps to reproduce ``` cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ cmake --build build ctest --test-dir build -R ^guest_jxr_bitio$ -V ``` AI-assisted: yes
Sign in to join this conversation.
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#26048
No description provided.