Skip to content

apple_sep: Touch ID is lost after a boot policy change when DESIGNATE_KEYBAG comes before the trusted-key unlock #1190

Closed

Description

@jgoyvaerts

After a boot policy change, Touch ID stops working and stays off on every boot until aurora-sep-policy-change is run and the Mac is rebooted. Every Recovery enrolment of a Stage 1 is such a change. The keybag, ref-key and fingerprints are intact; the driver's own one-boot window for this case doesn't open.

Seen on: J616s (T6040), integration/aurora with #985, #1079 and #1184, Arch Linux ARM, Touch ID enrolled on Linux. It happened after every Recovery enrolment on 2026-11-07, for a raw Stage 1 and a Mach-O Stage 1 alike (boots at 16:54, 17:28 and 19:29 on raw, 19:41 on Mach-O), and the same refusal repeats on every boot until the allowance is used:

apple_sep: xART guard level 1: 11 session records exist, 0 created by Linux; the other 11 are protected
apple_sep: xART guard: refused to rewrite kind-4 record <id>, which this Linux install did not create
apple_sep 406600000.sep: sks: DESIGNATE_KEYBAG got no reply after 2038 ms
apple_sep 406600000.sep: sks: DESIGNATE_KEYBAG did not complete; enrolment will refuse
apple_sep 406600000.sep: matching unavailable this boot: cold-match preparation, SCRD credential, Catacomb restore, or identity proof did not complete; template state is unproven

Why: xart_guard.rs lets the one kind-4 rewrite of a policy change through only inside policy_window. The only callers of policy_window are the trusted-key unlocks in refkey.rs (lines 287 and 362). Touch ID's restore path in sbio.rs (line 1991) calls sks_designate_user_keybag outside any window. On this Mac that DESIGNATE is the first use of the identity keybag under the new policy, so the enclave's rewrite comes during it. The guard refuses it and DESIGNATE_KEYBAG never answers. The trusted-key unlock that would have opened the window doesn't run first.

Workaround: run aurora-sep-policy-change once, then reboot. The next boot logs xART guard: allowed one rewrite of kind-4 record <id> for a boot policy change and Touch ID: restored 1 enrolled identity. On a distribution without SELinux the tool crashes after arming the allowance (the allowance still works); #1189 fixes that.

Possible fix, untested: run that first DESIGNATE under the window too, as the module comment describes the window ("the first unlock of an identity keybag that already existed, at most once per boot"):

crate::xart_guard::policy_window(|| self.sks_designate_user_keybag(handle, stored.secret()));

I haven't sent this as a PR. Testing it needs another boot policy change on hardware, and this Mac now boots its daily install from that very enrolment. If someone has a Mac where a re-enrolment is cheap, I can turn it into a PR with their result.

Activity

  1. satchlj commented on Nov 9, 2026

    @satchlj
    Member

    Same failure on a MacBook Air M3 (J613, T8122), so it isn't specific to the J616s.

    First change (2026-11-07): I moved Stage 1 from raw m1n1 to the Aura 1.0.0b5
    Mach-O Stage 1. The first boot of a 7.3 kernel built on integration/aurora
    11eccbe (which has e89d4a2) logged, in this order:

    sks: LOAD_KEYBAG reply mailbox status 0, ...
    apple_sep: xART guard: refused to rewrite kind-4 record <id>, which this Linux install did not create
    sks: DESIGNATE_KEYBAG got no reply after 2037 ms
    sks: DESIGNATE_KEYBAG did not complete; enrolment will refuse
    hwrng: read produced nothing (ETIMEDOUT)
    matching unavailable this boot ...
    

    T8122 takes T8112's variant-5 key store. So, as on your J616s, the only sender
    of DESIGNATE_KEYBAG is activate_touchid(), and it runs outside
    policy_window. This Mac's login screen offers Touch ID, so fprintd opens the
    sensor before anything unseals a trusted key, and the designate is the
    keybag's first use.

    The workaround worked: aurora-sep-policy-change with no arguments armed
    that record. The next boot logged:

    xART guard: this boot may rewrite kind-4 record <id> once, for a boot policy change
    xART guard: allowed one rewrite of kind-4 record <id> for a boot policy change; its previous value is in /var/lib/aurora-sep-xart-policy-previous.bin
    Touch ID: restored 1 enrolled identity/identities; enrolment survived reboot
    

    The Catacomb restore went through too. On later boots a kernel without the
    allowance code (from omacom/linux-aurora) brought Touch ID up as usual. The
    11eccbe copy of the tool had the restorecon crash you mentioned; #1189 fixed
    that.

    A planned change worked the first time (2026-11-08): I enrolled another
    Stage 1 build (1.0.0b5-hsusb1). Before the 1TR enrolment I ran
    aurora-sep-policy-change --expect on the daily kernel, which has the guard but
    not the allowance code. Then I made the first boot afterwards the 7.3 kernel.
    Touch ID survived that boot with no refusal round. On a kernel from before the
    allowance code, the refusal line names no session id, so --expect is the only
    way to arm from there.

    Fix: #1340 runs that designate in policy_window, as you suggested, with a
    host test and the docs (including the procedure above). It's built, and the
    apple_sep KUnit suites pass on arm64 QEMU. It hasn't been tested across a real
    policy change yet: that takes another Stage 1 enrolment.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions