Closed Bug 1724388 Opened 3 years ago Closed 3 years ago

Catch `EXC_GUARD` exceptions on macOS

Categories

(Toolkit :: Crash Reporting, enhancement)

All
macOS
enhancement

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: gsvelto, Assigned: gsvelto)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

We need to catch EXC_GUARD exceptions on macOS as they cover a variety of conditions that can be thrown when accessing resources that have been protected via guards (see guarded.h in macOS sources, the APIs are undocumented but are at least partly self-explanatory).

The various types of guards and how the related information is encoded in the exception code field are documented in exc_guard.h.

To implement this we need to do the following:

  • Add the EXC_GUARD exception to the list of exceptions we request to be notified of in the mac exception handler
  • Modify the mac minidump writer to account for these exception and store the code field correctly in the minidump
  • Adjust the minidump processor to properly decode the exception code field and print out its contents

Once we'll have applied these changes to mozilla-central I'll need to file another bug to import them in Socorro's stack-walker.

Adding the related issue in rust-minidump

Besides adding EXC_GUARD to the list of exceptions the exception handler
listens to and modifying the minidump processor to interpret the exception
correctly this patch introduces a unit-test that crashes with an EXC_RESOURCE
exception.

Information about the exception itself is available here:

https://github.com/apple/darwin-xnu/blob/main/osfmk/kern/exc_guard.h

Additional flavors for the exception are documented here:

https://github.com/apple/darwin-xnu/osfmk/mach/port.h
https://github.com/apple/darwin-xnu/osfmk/mach/vm_statistics.h

Last but not least the undocumented API that generates these exceptions and
which we use in the unit-test was inferred from this header:

https://github.com/apple/darwin-xnu/blob/main/bsd/sys/guarded.h

Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8be159457667
Add support for catching and processing EXC_GUARD exceptions on macOS r=KrisWright
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/614187392c03
Add support for catching and processing EXC_GUARD exceptions on macOS r=KrisWright
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: