Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-3596] Fix reporting of mach exception code and subcode #806

Merged
merged 8 commits into from
Sep 22, 2020

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Sep 16, 2020

Goal

This change brings in some improvements to mach exception handling that were made in KSCrash

These changes fix the parsing of mach exception code and subcode values.

Prior to these changes, for a EXC_BAD_ACCESS exception, the subcode did not contain the expected memory address. The exception handler was expecting the kernel to send 64-bit values, but 32-bit values were being sent instead because the MACH_EXCEPTION_CODES flag was not specified when registering the exception handler. There was also a struct padding issue (fixed by adding #pragma pack(4)) that was causing the exception handler to read values from the wrong offset, resulting in the memory address coming through as code and subcode to always contain the value 0x8.

Testing

I verified manually, using the example app, that the EXC_BAD_ACCESS mach exception is reported to the dashboard. The dashboard is now correctly identifying and displaying the memory address that the app tried to access.

Screenshot 2020-09-18 at 08 48 54

Copy link
Contributor

@kstenerud kstenerud left a comment

Choose a reason for hiding this comment

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

Please make sure the unsigned ints are safe for other languages to ingest (in particular, with the 64th bit set).

@nickdowell nickdowell changed the title [PLAT-3596] Incorporate KSCrash mach exception handling improvements [PLAT-3596] Fix reporting of mach exception code and subcode Sep 18, 2020
@nickdowell nickdowell force-pushed the 3596-fix-mach-exception-code-handling branch from c563316 to e725113 Compare September 21, 2020 16:03
@kstenerud kstenerud self-requested a review September 22, 2020 08:52
@nickdowell nickdowell merged commit 55f8cc0 into next Sep 22, 2020
@nickdowell nickdowell deleted the 3596-fix-mach-exception-code-handling branch September 22, 2020 08:54
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.

3 participants