Skip to content

apple_sep: on a J416c (M2 Max) the xART guard refuses identity-keybag creation, and the enclave stops answering #209

Open

Description

@maralcbr

Mac and installed build

Model / board / SoC: MacBook Pro 16" M2 Max / apple,j416c / apple,t6021 (driver profile T6020/J414s)
Installed: Omarchy Mac image 0.2.3 (omarchy-mac source 60d03b73, boot source 5b844604), fresh install 2026-10-25
uname -r: 7.2.11-4-1-ARCH
linux-aurora 7.2.11.aurora4-1 (omacom/linux-aurora 7b969982)
m1n1-aurora 1.6.1.aurora20-4, omarchy-mac 0.2.3-1, omarchy-mac-boot 20261024-1
libfprint-git 1:1.94.100.r10.g6f9479c-5, fprintd 1.94.5-2
Distribution / local patches: Omarchy on Arch Linux ARM, no local patches
Module options at load: xart_writes=1 provision_keybag=1, xart_guard default (-1 → 1)

Both firmware versions and provisioning

asahi,os-fw-version: 13.5
asahi,system-fw-version: 26.6.2 (mBoot-18000.161.10)
Own-Mac provisioning status: calibration carved from this Mac's own iBoot System Container by omarchy-mac; no keybag yet (new host-state store this boot)

This Mac has had earlier Omarchy installs, but Touch ID was never turned on under Linux, so no Linux install has had xART writes enabled. The session records in the gigalocker should all be macOS's.

Reproduction, expected result, and actual result

  1. Fresh Omarchy install on this Mac, then Setup > Security > Fingerprint and agree to turn on Touch ID.
  2. omarchy-mac writes xart_writes=1 provision_keybag=1 and loads apple-sep.

Expected: the identity keybag is created and /dev/sep-bio appears. If the guard has to refuse a write, CREATE_KEYBAG should fail cleanly with a reason, and the enclave should keep answering.

Actual, first attempt (1/1):

  • The guard refuses one rewrite of an existing kind-4 session record during keybag provisioning.
  • CREATE_KEYBAG gets no reply, and provisioning is abandoned for the boot.
  • After that the enclave stops answering: all 5 hwrng surveys time out.
  • /dev/sep-bio never appears.

Diag after the failure:

attach=attached  boot=warm  keybag=failed  keystore=open  matching=blocked
restore=unknown  sensor=unbound  sensor_attach=unknown  touchid=failed
xart=enabled  xart_guard=1  xart_guard_list=loaded  xart_guard_refusals=1

The guard's list (/var/lib/aurora-sep-xart-owned.bin) is empty, which is expected on a fresh install. Read-only headers of the live gigalocker records (UUIDs omitted):

slot kind len revision
0 4 64 4631
1 3 108 4498
2 1 (root) 1241 4636
3 4 40 4746
4 4 441 726
5 4 8212 723
6 4 128 574
8 4 2715 4749
9 4 182 4647
10 2 (root) 852 4751
11 4 339 4650
12 3 2604 851

The refusal log doesn't name the record, so I can't tell which kind-4 record the enclave wanted. Since Linux never had writes enabled on this Mac, it should be a macOS record.

Why this isn't the case 5c6aef8 anticipates:

  1. 5c6aef8 says a guarded keybag creation on an M2 (J413) made no xART write. It names only Macs that enrolled before the guard existed as needing xart_guard=0. This J416c never enrolled under Linux, yet keybag creation on it rewrites an existing kind-4 record. That matches what the commit describes for cold-boot M1-family Macs, but this one boots warm (boot=warm).
  2. With the default guard, Touch ID therefore can't be turned on at all on this Mac. The only way through is xart_guard=0, which lets the enclave rewrite what looks like a macOS record.
  3. A refused write leaves the enclave unresponsive until a restart. The guard's own documentation says a refusal should fail the request "the same way a read-only gigalocker does".

Questions:

  • Is a kind-4 rewrite during CREATE_KEYBAG expected on T6020/T6021 (or on system firmware 26.6.x), unlike J413?
  • If so, should M2 Pro/Max get the M1-family treatment: report keybag creation as blocked by the guard up front, rather than attempting it?
  • Could the refusal log include the record's slot and revision?
  • Could a refused write during CREATE_KEYBAG fail the exchange without wedging the enclave?

Relevant error lines

2026-10-25T13:42:05+10:00 apple_sep: M2 Pro/Max on system firmware 26.6.2 (mBoot-18000.161.10), OS firmware 13.5: using the variant-5 key store
2026-10-25T13:42:05+10:00 apple_sep 396400000.sep: SEP platform profile: T6020/J414s
2026-10-25T13:42:05+10:00 apple_sep: xART guard level 1: 10 session records exist, 0 created by Linux; the other 10 are protected
2026-10-25T13:42:05+10:00 apple_sep 396400000.sep: xART: APFS-resolved .gl extent (base 0x4d4000); 170 slots, 12 live records, max revision 4750, 0 malformed, 0 duplicate, 0 repaired; writes ENABLED
2026-10-25T13:42:05+10:00 apple_sep: created a new host-state store
2026-10-25T13:42:06+10:00 apple_sep 396400000.sep: attach: 7 endpoints advertised in 18 messages
2026-10-25T13:42:06+10:00 apple_sep 396400000.sep: xART: using /chosen/apfs-preboot-uuid
2026-10-25T13:42:09+10:00 apple_sep: xART guard: refused to rewrite a kind-4 record this Linux install did not create
2026-10-25T13:42:10+10:00 apple_sep 396400000.sep: sks: CREATE_KEYBAG got no reply after 2027 ms
2026-10-25T13:42:10+10:00 apple_sep 396400000.sep: sks: CREATE_KEYBAG exchange did not complete (buffers unregistered, wedged, or OOL write failed)
2026-10-25T13:42:10+10:00 apple_sep 396400000.sep: bringup: identity-keybag provisioning failed; no retry this boot
2026-10-25T13:42:13+10:00 apple_sep 396400000.sep: hwrng: survey attempt 1 failed (ETIMEDOUT); retrying
...
2026-10-25T13:42:36+10:00 apple_sep 396400000.sep: hwrng: survey failed after 5 attempts (ETIMEDOUT)

Related issues, pull requests, or code examples

What was not tested

  • No restart or second attempt yet. The driver says to restart before retrying.
  • xart_guard=0 not tried.
  • macOS on this Mac not booted since, so its keychain and Touch ID state are unchecked.
  • Which kind-4 record was refused.
  • Other M2 boards, and older system firmware.

Activity

  1. chriskearney commented on Oct 25, 2026

    @chriskearney

    I traced this against the installed source, 7b969982306e1498a8cbe6e5da9bde743acd8fc5.

    The default-on trigger is 5c6aef8a, dated October 18 UTC. c435b16b introduced the guard as opt-in; 5c6aef8 enabled it for T6020, which this T6021 uses. Both entered Omacom through Ryan's (@RyanTheTide) PR #139 on October 19. Its first parent has no guard. This is source tracing, not a hardware bisect.

    At level 1, an existing kind-4 record absent from this install's ownership list is refused before that record is written. Provisioning has no guard-aware preflight, so it can start CREATE_KEYBAG and encounter that refusal partway through. The warm J413 result used to justify the default does not cover this warm J416c result.

    The failure path constructs XARM status 0x16 and calls send_xarm_reply(); that function discards the mailbox send result. We therefore cannot yet distinguish failed reply delivery from SEP not recovering after a delivered refusal. CREATE's timeout marks the SKS endpoint wedged, and bring-up returns before register_bio(), explaining the missing device. The entropy surveys do not check sks_wedged; their counted ETIMEDOUT failures are not simply that SKS software gate blocking them.

    I'd keep the guard enabled and add a guarded-provisioning preflight for this unqualified case, record the refused slot/revision without UUIDs or payloads, and report XARM reply-send errors. The particular record's ownership and the cause of the post-refusal silence remain unproven. No guard-off test or hardware bisect was performed for this review.

  2. maralcbr commented on Oct 25, 2026

    @maralcbr
    MemberAuthor

    Update: a macOS boot clears it; Touch ID then works with the guard on

    The same J416c was tested again: guard level 1 and the real preboot UUID throughout. This corrects the issue body in two places:

    • The refused record is a shared SEP-xART locker. It isn't a per-OS record.
    • With the guard on, Touch ID is not blocked for good. One macOS boot after the install clears it.

    Before (fresh install, Linux's first boot)

    kprobes on Guard::check and xart_store::Store::{read,write}, plus xarm_trace=1, show:

    • The SEP reads both roots, then four kind-4 lockers: 19CAE27B (2715 B), DB35D704, 059B7BB0, D5246450.
    • It writes the kind-2 root (allowed).
    • It asks to rewrite 19CAE27B to 1137 B (op 0x06, request_len 1153). The guard refuses; CREATE_KEYBAG never replies and the SEP hangs until a restart.

    macOS boot (no new enrolment; one finger was already enrolled)

    • macOS rewrites 19CAE27B from 2715 B to 1137 B on its own: the same transition the guard blocked under Linux.
    • It also rewrites DCBF5F70, 2F104158, 23DB71C9 and both roots.
    • DB35D704, 059B7BB0 and D5246450 stay unchanged.

    After (Linux, guard on)

    • The SEP reads 19CAE27B at 1137 B and writes nothing: sks: identity keybag provisioned, zero refusals, .gl byte-identical before and after.
    • Enrolment (1 finger), a match, a restart (Touch ID: restored 1 enrolled identity) and a match after the restart all pass.
    • Every Linux write after that went to the kind-1 root (1241 → 1447 B). No session record was written.

    macOS afterwards

    • macOS reads the 1447 B kind-1 root without complaint. Its template count is still 1, and lock-screen unlock by finger works (APEventTouchIDMatch).
    • Login keychain: _keychainPasswordReset:0, _keychainMovedAside:0.
    • Back in Linux, the enrolment restores and matches again.

    Scoping

    macOS's AppleSEPXART log shows it reading the same four lockers at boot, under its own OS UUID (different from Linux's). The reply lengths match the records exactly: 1137, 182, 441 and 40. macOS calls kinds 2 and 4 "SEP-xART" (root and locker) and kinds 1 and 3 "USER-xART". So these lockers are not per-OS.

    The likely source of the 2715 B state is the stub install (recoveryOS, about 12 minutes before Linux's first boot), with whichever OS boots next completing the transition. That is not confirmed.

    Still worth fixing

    1. A refused write during CREATE_KEYBAG hangs the SEP, rather than failing closed as XART-SAFETY.md describes.
    2. The timed-out create leaves a state-0 intent record in /var/lib/aurora-sep-keybag.bin, so every later attempt returns EEXIST. Restarting and retrying can't recover without moving the file aside by hand.
    3. XART-SAFETY.md lists M2 Pro/Max keybag creation as untested. It now has a measurement: refused on a fresh install whose first boot is Linux, no xART writes after one macOS boot.

    Downstream, Omarchy will tell owners to boot macOS once after a fresh install before turning on Touch ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions