Skip to content

Conversation

@themiswang
Copy link
Contributor

@themiswang themiswang commented Dec 16, 2025

Related issue: #15393

Tested on:

  • iOS15 (min version we support)
  • arm macOS
  • intel macOS

Note: macOS10.5 and 11 does not support identity protection so it fallback to default behavior, addressed in the later pr

Change exception behaviors from default to identity protected
Context: https://developer.apple.com/documentation/xcode/conforming-to-mach-ipc-security-restrictions

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@themiswang themiswang force-pushed the machIPC branch 2 times, most recently from 8030fd5 to c35e403 Compare December 16, 2025 22:26
@themiswang themiswang requested a review from mrober December 16, 2025 22:27
@themiswang themiswang force-pushed the machIPC branch 3 times, most recently from d22c92e to 791dc5d Compare December 17, 2025 16:59
@themiswang themiswang marked this pull request as ready for review December 17, 2025 17:13
@themiswang themiswang force-pushed the machIPC branch 3 times, most recently from 2dda7ac to c7a16af Compare January 2, 2026 20:09
@themiswang themiswang requested a review from mrober January 14, 2026 17:51
@themiswang themiswang requested a review from ncooke3 January 14, 2026 21:34
@ncooke3
Copy link
Member

ncooke3 commented Jan 14, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the Mach exception handling to conform to newer security restrictions by using EXCEPTION_IDENTITY_PROTECTED. The changes to use task identity tokens and thread IDs are well-implemented. However, I've found a couple of critical issues in the new FIRCLSCrashedThreadLookup function and its usage. One is a use-after-free bug due to premature deallocation of the crashed thread's port, and another is the use of an uninitialized variable. I've provided detailed comments and suggestions to fix these issues. Once these are addressed, the changes should be solid.

@themiswang themiswang force-pushed the machIPC branch 2 times, most recently from 7b56d58 to 7c052fe Compare January 14, 2026 22:23
@themiswang
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Mach exception handling to conform to newer security restrictions by using EXCEPTION_IDENTITY_PROTECTED. This changes the exception message format, and the code has been updated to handle this by getting the task port from a token and looking up the thread port from a thread ID. The changes are well-implemented, but I've identified two resource leaks related to Mach port handling that should be addressed. Otherwise, the changes look good.

@themiswang
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the Mach exception handling to conform to Apple's new Mach IPC security restrictions by using EXCEPTION_IDENTITY_PROTECTED. The changes properly adapt the exception message handling, including looking up the task port from a token and finding the crashed thread by its ID. The resource management for the acquired Mach ports also appears to be handled correctly. I have a minor suggestion to improve code clarity by renaming a struct field to avoid confusion with a type name.

@ncooke3
Copy link
Member

ncooke3 commented Jan 15, 2026

The failures look like flakes in the context manager tests. That class has some async dispatches, so it is likely those not resolving due to background priority.

@themiswang themiswang merged commit 098de4d into main Jan 16, 2026
51 of 52 checks passed
@themiswang themiswang deleted the machIPC branch January 16, 2026 19:28
@themiswang themiswang changed the title Conforming to Mach IPC security restrictions [Crashlytics] Conforming to Mach IPC security restrictions Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants