Skip to content

Metal backend: add export-time code signing for Hardened Runtime#18768

Draft
mergennachin wants to merge 1 commit intomainfrom
turboquant
Draft

Metal backend: add export-time code signing for Hardened Runtime#18768
mergennachin wants to merge 1 commit intomainfrom
turboquant

Conversation

@mergennachin
Copy link
Copy Markdown
Contributor

The Metal AOTI backend extracts a compiled .so from the .pte at runtime
and dlopen's it. macOS Hardened Runtime rejects unsigned dlopen'd code,
making Metal-backend .pte files unusable in notarized apps.

Add a codesign_so hook to AotiBackend (no-op by default) that runs
after AOTInductor compilation and before the .so is packed into the .pte.
MetalBackend overrides it to run codesign when a codesign_identity
compile spec is provided. Wire --codesign-identity through the Voxtral
Realtime and Parakeet export scripts.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 8, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18768

Note: Links to docs will display an error until the docs builds have been completed.

⏳ 6 Pending, 2 Unrelated Failures

As of commit 3517c6d with merge base e109ac8 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@mergennachin mergennachin force-pushed the turboquant branch 2 times, most recently from f86121f to fa44add Compare April 8, 2026 09:38
The Metal AOTI backend extracts a compiled .so from the .pte at runtime
and dlopen's it. macOS Hardened Runtime rejects unsigned dlopen'd code,
making Metal-backend .pte files unusable in notarized apps.

Add a `codesign_so` hook to `AotiBackend` (no-op by default) that runs
after AOTInductor compilation and before the .so is packed into the .pte.
`MetalBackend` overrides it to run `codesign` when a `codesign_identity`
compile spec is provided. Wire `--codesign-identity` through the Voxtral
Realtime and Parakeet export scripts. Add an e2e test in test_modules
that exports a toy model with ad-hoc signing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant