mach: Support raising EXCEPTION_*_IDENTITY_PROTECTED [crashpad/crashpad : main]

6 views
Skip to first unread message

Justin Cohen (Gerrit)

unread,
May 6, 2026, 6:15:55 PM (10 days ago) May 6
to SLSA Policy Verification Service, Mark Mentovai, crashpa...@luci-project-accounts.iam.gserviceaccount.com, crashp...@chromium.org
Attention needed from Mark Mentovai

Justin Cohen added 3 comments

Patchset-level comments
File-level comment, Patchset 3:
Mark Mentovai . resolved

There’s also EXCEPTION_IDENTITY_PROTECTED.

Crashpad already handles things like EXCEPTION_IDENTITY. Should it handle EXCEPTION_IDENTITY_PROTECTED too?

Justin Cohen

Is that useful for Crashpad? EXCEPTION_IDENTITY_PROTECTED does not carry thread state.

```
routine mach_exception_raise_identity_protected(
exception_port : mach_port_t;
thread_id : uint64_t;
task_id_token_t : mach_port_t;
exception : exception_type_t;
code : mach_exception_data_t
);
```
Mark Mentovai

Is that useful for Crashpad? EXCEPTION_IDENTITY_PROTECTED does not carry thread state.

Same situation as for `EXCEPTION_IDENTITY`, which Crashpad does implement.

If receiving an identity-only behavior, Crashpad will make an extra call to look up the thread state.

It’s also valid in case Crashpad needs to forward to an exception handler with this behavior.

Justin Cohen

Acknowledged

File-level comment, Patchset 3:
Justin Cohen . resolved

I'm not sure if this CL is necessary, but it was pointed out to me that I missed updating util/mach/symbolic_constants_mach.cc with the new exception types, which led to updating the tests, and then the exc_client.

I don't think we use any of this on the iOS side of things (unless iOS changes CrashHandler::CatchMachException to Forward exceptions to original_handlers_ -- there's still a TODO there)

WDYT?

Justin Cohen

Acknowledged

File util/mach/exc_client_variants.cc
Line 128, Patchset 8: return KERN_NOT_SUPPORTED;
Mark Mentovai . resolved

Add a comment saying that `EXCEPTION_IDENTITY_PROTECTED | kMachExceptionCodes` could be viable, but isn’t implemented for (insert reason). This is in contrast to the other two, which aren‘t viable combinations.

Justin Cohen

Added support

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Mentovai
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
Gerrit-Change-Number: 7736788
Gerrit-PatchSet: 11
Gerrit-Owner: Justin Cohen <justi...@google.com>
Gerrit-Reviewer: Justin Cohen <justi...@google.com>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Wed, 06 May 2026 22:15:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Comment-In-Reply-To: Justin Cohen <justi...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
May 7, 2026, 9:49:28 AM (9 days ago) May 7
to Justin Cohen, SLSA Policy Verification Service, crashpa...@luci-project-accounts.iam.gserviceaccount.com, crashp...@chromium.org
Attention needed from Justin Cohen

Mark Mentovai added 7 comments

File util/mach/exc_client_variants.cc
Line 125, Patchset 13 (Latest): case EXCEPTION_IDENTITY_PROTECTED:
case EXCEPTION_STATE_IDENTITY_PROTECTED:
return KERN_NOT_SUPPORTED;
Mark Mentovai . unresolved

These would be a caller error. Let’s actually just `NOTREACHED` these explicitly (but reordered to be with the `exc` stuff, not in the middle of the `mach_exc` stuff), along with a comment explaining. Or just let them use the `default:` label without an explicit callout.

File util/mach/exc_server_variants.cc
Line 92, Patchset 13 (Latest): static const mach_msg_id_t
kMachMessageIDExceptionRaiseStateIdentityProtected = 2411;
static const mach_msg_id_t kMachMessageIDExceptionRaiseIdentityProtected =
2412;
Mark Mentovai . unresolved

I’m curious where these numbers came from. These seem to correspond to the non-`MACH_EXCEPTION_CODES` protected behaviors, which don’t actually exist. They’re just made up, right? Do we need them at all?

If not, get rid of them.

If we need them as placeholders, let’s at least not have them overlap a viable namespace. They should also come with a comment explaining the situation.

Line 112, Patchset 13 (Latest): using ExceptionRaiseStateIdentityProtectedRequest =
__Request__mach_exception_raise_state_identity_protected_t;
using ExceptionRaiseIdentityProtectedRequest =
__Request__mach_exception_raise_identity_protected_t;
Mark Mentovai . unresolved

Keep the order in line with `<mach/mach_exc.defs>`, which puts identity before state_identity. Same on lines 121–124, and again with function definitions like 152–167, and in many other places in this file.

Line 288, Patchset 13 (Latest): virtual kern_return_t CatchExceptionRaiseIdentityProtected(
Mark Mentovai . unresolved

Public interface wants documentation.

File util/mach/exc_server_variants_test.cc
Line 1003, Patchset 13 (Latest): 2409,
Mark Mentovai . unresolved

2411 too, since that’s one off from the last valid one now.

Line 1014, Patchset 13 (Latest): 2508,
Mark Mentovai . unresolved

Complete this list too, through 2511, inclusive.

File util/mach/exception_behaviors.cc
Line 23, Patchset 13 (Latest): basic_behavior == EXCEPTION_STATE_IDENTITY_PROTECTED;
Mark Mentovai . unresolved

Since this isn’t defined for non-`MACH_EXCEPTION_CODES`, you should check for the correct `behavior` value, not `basic_behavior`.

Same on lines 30–31.

Open in Gerrit

Related details

Attention is currently required from:
  • Justin Cohen
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
    Gerrit-Change-Number: 7736788
    Gerrit-PatchSet: 13
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Comment-Date: Thu, 07 May 2026 13:49:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    May 8, 2026, 11:25:24 PM (8 days ago) May 8
    to SLSA Policy Verification Service, Mark Mentovai, crashpa...@luci-project-accounts.iam.gserviceaccount.com, crashp...@chromium.org
    Attention needed from Mark Mentovai

    Justin Cohen voted and added 7 comments

    Votes added by Justin Cohen

    Commit-Queue+1

    7 comments

    File util/mach/exc_client_variants.cc
    Line 125, Patchset 13: case EXCEPTION_IDENTITY_PROTECTED:
    case EXCEPTION_STATE_IDENTITY_PROTECTED:
    return KERN_NOT_SUPPORTED;
    Mark Mentovai . resolved

    These would be a caller error. Let’s actually just `NOTREACHED` these explicitly (but reordered to be with the `exc` stuff, not in the middle of the `mach_exc` stuff), along with a comment explaining. Or just let them use the `default:` label without an explicit callout.

    Justin Cohen

    Done

    File util/mach/exc_server_variants.cc
    Line 92, Patchset 13: static const mach_msg_id_t

    kMachMessageIDExceptionRaiseStateIdentityProtected = 2411;
    static const mach_msg_id_t kMachMessageIDExceptionRaiseIdentityProtected =
    2412;
    Mark Mentovai . resolved

    I’m curious where these numbers came from. These seem to correspond to the non-`MACH_EXCEPTION_CODES` protected behaviors, which don’t actually exist. They’re just made up, right? Do we need them at all?

    If not, get rid of them.

    If we need them as placeholders, let’s at least not have them overlap a viable namespace. They should also come with a comment explaining the situation.

    Justin Cohen

    Yup, made up, protected exceptions do not exist for the 32-bit exc subsystem.

    To remove them I'd need to change the references in MachMessageServerRequestIDs. How about adding a static RequestIDs helper in both traints (in this patchset)

    Line 112, Patchset 13: using ExceptionRaiseStateIdentityProtectedRequest =

    __Request__mach_exception_raise_state_identity_protected_t;
    using ExceptionRaiseIdentityProtectedRequest =
    __Request__mach_exception_raise_identity_protected_t;
    Mark Mentovai . resolved

    Keep the order in line with `<mach/mach_exc.defs>`, which puts identity before state_identity. Same on lines 121–124, and again with function definitions like 152–167, and in many other places in this file.

    Justin Cohen

    Done

    Line 288, Patchset 13: virtual kern_return_t CatchExceptionRaiseIdentityProtected(
    Mark Mentovai . resolved

    Public interface wants documentation.

    Justin Cohen

    Done

    File util/mach/exc_server_variants_test.cc
    Line 1003, Patchset 13: 2409,
    Mark Mentovai . resolved

    2411 too, since that’s one off from the last valid one now.

    Justin Cohen

    Done

    Line 1014, Patchset 13: 2508,
    Mark Mentovai . resolved

    Complete this list too, through 2511, inclusive.

    Justin Cohen

    Done

    File util/mach/exception_behaviors.cc
    Line 23, Patchset 13: basic_behavior == EXCEPTION_STATE_IDENTITY_PROTECTED;
    Mark Mentovai . resolved

    Since this isn’t defined for non-`MACH_EXCEPTION_CODES`, you should check for the correct `behavior` value, not `basic_behavior`.

    Same on lines 30–31.

    Justin Cohen

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mark Mentovai
    Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
      Gerrit-Change-Number: 7736788
      Gerrit-PatchSet: 14
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
      Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
      Gerrit-Comment-Date: Sat, 09 May 2026 03:25:21 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mark Mentovai (Gerrit)

      unread,
      May 11, 2026, 12:57:08 PM (5 days ago) May 11
      to Justin Cohen, SLSA Policy Verification Service, crashpa...@luci-project-accounts.iam.gserviceaccount.com, crashp...@chromium.org
      Attention needed from Justin Cohen

      Mark Mentovai voted and added 1 comment

      Votes added by Mark Mentovai

      Code-Review+1

      1 comment

      File util/mach/exc_server_variants.cc
      Line 92, Patchset 13: static const mach_msg_id_t
      kMachMessageIDExceptionRaiseStateIdentityProtected = 2411;
      static const mach_msg_id_t kMachMessageIDExceptionRaiseIdentityProtected =
      2412;
      Mark Mentovai . resolved

      I’m curious where these numbers came from. These seem to correspond to the non-`MACH_EXCEPTION_CODES` protected behaviors, which don’t actually exist. They’re just made up, right? Do we need them at all?

      If not, get rid of them.

      If we need them as placeholders, let’s at least not have them overlap a viable namespace. They should also come with a comment explaining the situation.

      Justin Cohen

      Yup, made up, protected exceptions do not exist for the 32-bit exc subsystem.

      To remove them I'd need to change the references in MachMessageServerRequestIDs. How about adding a static RequestIDs helper in both traints (in this patchset)

      Mark Mentovai

      Yup, made up, protected exceptions do not exist for the 32-bit exc subsystem.

      To remove them I'd need to change the references in MachMessageServerRequestIDs. How about adding a static RequestIDs helper in both traints (in this patchset)

      I like it!

      More modern `std::set` construction, too. Nice.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Justin Cohen
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
      Gerrit-Change-Number: 7736788
      Gerrit-PatchSet: 14
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
      Gerrit-Attention: Justin Cohen <justi...@google.com>
      Gerrit-Comment-Date: Mon, 11 May 2026 16:57:04 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      Comment-In-Reply-To: Justin Cohen <justi...@google.com>
      satisfied_requirement
      open
      diffy

      Justin Cohen (Gerrit)

      unread,
      May 11, 2026, 9:49:02 PM (5 days ago) May 11
      to Mark Mentovai, SLSA Policy Verification Service, crashpa...@luci-project-accounts.iam.gserviceaccount.com, crashp...@chromium.org

      Justin Cohen voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
      Gerrit-Change-Number: 7736788
      Gerrit-PatchSet: 14
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
      Gerrit-Comment-Date: Tue, 12 May 2026 01:48:59 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      crashpad-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

      unread,
      May 11, 2026, 10:01:37 PM (5 days ago) May 11
      to Justin Cohen, Mark Mentovai, SLSA Policy Verification Service, crashp...@chromium.org

      crashpa...@luci-project-accounts.iam.gserviceaccount.com submitted the change

      Change information

      Commit message:
      mach: Support raising EXCEPTION_*_IDENTITY_PROTECTED

      This is a follow-up to 226847ab2f143ffeb51822ed0cc39d358614c727, which
      added server-side support for EXCEPTION_STATE_IDENTITY_PROTECTED.
      This change implements client-side and server-side support for raising,
      receiving, and forwarding both EXCEPTION_STATE_IDENTITY_PROTECTED and
      EXCEPTION_IDENTITY_PROTECTED exceptions via UniversalExceptionRaise()
      and UniversalMachExcServer.

      This is required to allow unit testing of the protected exception paths
      in exc_client_variants_test, and to support future forwarding of Mach
      exceptions to original handlers in the iOS crash handler on iOS 18+.
      Bug: 401232341
      Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
      Commit-Queue: Justin Cohen <justi...@google.com>
      Reviewed-by: Mark Mentovai <ma...@chromium.org>
      Files:
      • M util/mach/exc_client_variants.cc
      • M util/mach/exc_client_variants_test.cc
      • M util/mach/exc_server_variants.cc
      • M util/mach/exc_server_variants_test.cc
      • M util/mach/exception_behaviors.cc
      • M util/mach/symbolic_constants_mach.cc
      • M util/mach/symbolic_constants_mach_test.cc
      Change size: L
      Delta: 7 files changed, 292 insertions(+), 17 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Mark Mentovai
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I6b6fd63cfa9d32f93b9bb05901811a085c2d72b7
      Gerrit-Change-Number: 7736788
      Gerrit-PatchSet: 15
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages