fix(libc): don't walk guest frame pointers when reporting an unhandled exception #52

Merged
oneandonlydean merged 1 commit from upstream-pr/52 into main 2026-09-28 06:10:38 +00:00
oneandonlydean commented 2026-09-28 01:24:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-28T01:24:50Z.


What

When _Unwind_RaiseException returns without finding a handler, __cxa_throw logs the caller by walking one frame-pointer link. Guest code is built without frame pointers, so rbp holds arbitrary data, and the log itself segfaults (e.g. reading 0xc8000008). That hides the real error, which in my case was a std::invalid_argument thrown by MapAligned.

How

Only log __builtin_return_address(0), which doesn't depend on the guest's frames. After the fix, the log prints the exception type and the terminate handler prints what().

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4658147604 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/52). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-28T01:24:50Z. --- ### What When `_Unwind_RaiseException` returns without finding a handler, `__cxa_throw` logs the caller by walking one frame-pointer link. Guest code is built without frame pointers, so `rbp` holds arbitrary data, and the log itself segfaults (e.g. reading `0xc8000008`). That hides the real error, which in my case was a `std::invalid_argument` thrown by `MapAligned`. ### How Only log `__builtin_return_address(0)`, which doesn't depend on the guest's frames. After the fix, the log prints the exception type and the terminate handler prints `what()`.
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!52
No description provided.