Skip to content

Offer Touch ID on the M1 MacBook Air (J313) - #162

Closed
malik-na wants to merge 5 commits into
mainfrom
mac/touchid-j313
Closed

malik-na wants to merge 5 commits into
mainfrom
mac/touchid-j313

Conversation

@malik-na

@malik-na malik-na commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Why

Touch ID on the MacBook Air M1 (J313), with the Secure Enclave driver's xART guard kept on. Today touchid-eligibility reads unsupported:m1-family on every M1.

Summary

  • touchid-eligibility:
  • touchid-options (new): prints the driver options line both writers use (touchid-enable, entrypoints/enable-fingerprint): xart_writes=1 provision_keybag=1, plus xart_guard_pins=1 on the J313 only.
  • touchid-enable: before loading on the J313, it sets aside an earlier try's guard list (/var/lib/aurora-sep-xart-owned.bin) and an uncommitted keybag in /var/lib/aurora-sep-touchid-retry-<time>/.
    • The pin window opens only on an empty list, so without this a try that failed on an older kernel would block every later one.
    • "Committed" is read from the keybag's own header (magic and state 1 or 3), not its size. A committed keybag keeps its list, and any failed move fails the setup.
  • README and manual: the manual says Touch ID is offered on the M1 Air only with a kernel whose driver lets exactly the three setup records through.

Evidence

All on one MacBook Air M1 (J313), macOS 13.5 firmware, 2026-11-19:

  • Kernel: #506 at omacom/linux-aurora@a71e98bd8 (built as 2b718e52a, the same tree before the sign-off rebase; the head since, 56b08faee, changes only comments and docs), booted with options xart_writes=1 provision_keybag=1 xart_guard_pins=1, the line touchid-options writes on the J313.
  • Setup: three pre-Linux lockers pinned, identity keybag provisioned, xart_guard_refusals 0, activation ready.
  • Enrol and match: fprintd-enroll completed; 3 of 3 verify-match.
  • Reboot: enrolment survived reboot, 2 of 2 verify-match, refusals 0.
  • Keybag check on that Mac: read-only, the header check calls the M1's real keybag (116 bytes) committed and a 52-byte header from a failed try not committed.
  • macOS: the owner reported macOS Touch ID still works after the earlier guard-pinned setup on the same Mac.

Verified

  • Suite: omarchy-mac/test/all passes all 122 checks. check-scope, check-architecture-gates and check-fixture-drift pass. omarchy-mac/version is unchanged (release bumps only).
  • Consent test, red first: the new cases fail on this PR's previous commit (the M1 Air is not offered Touch ID on a kernel that pins one locker at the create read available).
  • Mutations: a size-only keybag rule fails the new "unwritten" case. A modinfo stub answering a different module fails the J313 case. From the second review, each of these fails the suite: dropping 3 from [13], masking a failed mv, setting aside after modprobe, going back to is-active, treating only inactive as ended, and removing the load unit's kernel check.
  • Independent review: each of the review's points was checked by a separate agent against the code. Their findings are folded in: the move loop masked a failed mv, the keybag test used a size proxy, and the modinfo stub ignored its arguments.

Depends on

Recovery

  • A setup that crashed between the agreement and the load, or whose spent state ends at failed, not-ready or blocked, is set aside by the fingerprint setup's agreed branch (lib/touchid-retry-aside, under the Touch ID lock), so the restart sets it up again. With no status recorded, or while the activation runs (its ActiveState is anything but inactive or failed), nothing moves.
  • An owner who agreed and then boots a kernel without xart_guard_pins is told the kernel can't set Touch ID up on this Mac, not to restart. omarchy-mac-touchid-load.service skips the load on that kernel (ExecCondition=/usr/lib/omarchy-mac/touchid-kernel-ready, the check eligibility makes), so the driver stays off until a kernel with the pins is back. If #506 renames the parameter again, lib/touchid-kernel-ready changes with it.

Not covered

  • J293, T6000 and T6001.
  • Sleep and resume, lockout, a second user, and deleting a print.

🤖 Generated with Claude Code

malik-na and others added 2 commits November 19, 2026 08:40
touchid-eligibility admits apple,j313 on apple,t8103; the other M1-family
boards (J293, J274, M1 Pro and Max) still read unsupported:m1-family.

On the J313 the first setup rewrites a key-store session record macOS
created, which the driver's xART guard refuses (omacom/linux-aurora#223:
"refused to rewrite a kind-4 record this Linux install did not create",
then CREATE_KEYBAG fails). The new lib/touchid-options prints the driver
options both writers use (touchid-enable and enable-fingerprint) and adds
xart_guard=0 on the J313 only, so the owner's agreement loads the driver
with the guard off there and nowhere else.

The README and the manual's Touch ID section say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
touchid-options now gives the J313 xart_guard_pin=1 (omacom/linux-aurora#486)
in place of xart_guard=0. On the J313 the first setup rewrites three
pre-Linux kind-4 lockers, two at the keybag's COPY_KEYBAG and one at the first
activation's LOAD_KEYBAG; with the window held through the first activation
and room for three pins, setup, enrol, match and a reboot restore pass with
xart_guard_refusals 0, and the guard keeps every other macOS record. #486 as
posted pins one locker around CREATE_KEYBAG only and fails on the J313; the
changes it needs are reported there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this, and for testing the pin on the J313 itself. The script changes look right and the tests catch it if you break them (I tried). I'd hold it until the kernel side is published, and add a gate so it doesn't depend on merge order.

Nothing checks the kernel. lib/touchid-eligibility:51 says available for any J313, and lib/touchid-options:15 always adds xart_guard_pin=1. On a kernel without the parameter, modprobe ignores it and the guard refuses the setup. On a kernel with #486 but not #506, only one locker gets pinned, and in #506's own J313 run the second was then refused. The owner gets the one-time invitation, then a setup that can't finish. AGENTS.md asks for everything an invitation leads to to be published first.

A failed try makes the next one worse. #486 and #506 both say a Mac that already tried under the guard has to remove /var/lib/aurora-sep-xart-owned.bin before the pin window opens again. Nothing in omarchy-mac removes it, so after a failed try on an old kernel, upgrading the kernel won't be enough.

Could eligibility return something like unsupported:kernel on the J313 unless modinfo -p apple_sep shows the pin? It has to tell #506 apart from #486, so that needs a marker on the kernel side, which I've asked for on #506. It could be a new parameter name or a version that modinfo shows. The diag abi file only exists once the driver is loaded.

Smaller things:

  • mac-manual/content/04-security.md:42 says the driver lets the three records through. That's only true on a kernel that has #506.
  • test/touchid-consent-test.sh:256 still says "loads with the guard off".
  • test/touchid-consent-test.sh:580 only checks the exit code. The J313's options file is still there at that point (it's removed at 582), so nothing gets rewritten. Remove it first, then check that the M2 Max line has no pin.
  • The description still says xart_guard=0 in Summary, Evidence and Verified.

omarchy-mac/version is unchanged.

From the review of #162:

- touchid-eligibility records unsupported:kernel on the J313 unless
  `modinfo -p apple_sep` lists xart_guard_pins (omacom/linux-aurora#506).
  A kernel with #486's xart_guard_pin pins one locker at the create and
  cannot finish the setup; a built-in driver lists no parameters and is
  refused too, so the one-time invitation never leads to a setup that
  cannot finish.
- touchid-options writes xart_guard_pins=1 on the J313.
- Before loading on the J313, touchid-enable sets aside an earlier try's
  guard list and uncommitted keybag (anything without the driver's magic
  and a committed state) in /var/lib/aurora-sep-touchid-retry-<time>/, so
  the pin window opens again after a try that failed on an older kernel.
  A committed keybag keeps its list; any failed move fails the setup.
- Tests: the kernel check against #506, #486 and parameter-less kernels;
  the set-aside for a list, a header, both, an unwritten file and a
  committed keybag; the M2 Max's options carry no pin. The manual says
  Touch ID is offered on the M1 Air only with such a kernel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks, all addressed in e03a3b2. Each fix was checked by a separate agent against the code.

Nothing checks the kernel.

  • touchid-eligibility now records unsupported:kernel on the J313 unless modinfo -p apple_sep lists xart_guard_pins.
  • That name is the marker you asked for on #506: the parameter is renamed there, so #486's xart_guard_pin doesn't match.
  • A built-in driver lists no parameters, so it's refused too.
  • touchid-options writes xart_guard_pins=1.
  • Tests: a #506 kernel is available; a #486 kernel and a parameter-less one are unsupported:kernel. The modinfo stub answers only -p apple_sep.

A failed try makes the next one worse.

  • Before loading on the J313, touchid-enable moves an earlier try's guard list and uncommitted keybag into /var/lib/aurora-sep-touchid-retry-<time>/.
  • It reads "committed" from the keybag's header (magic, then state 1 or 3 at 0x14), not from its size. A committed keybag keeps its list, and any failed move fails the setup.
  • Tests: list only, header only, both, an unwritten file, a committed keybag, and an M2 Max whose list is never touched.
  • Gap left, written up in the description: a crash between recording the agreement and loading the driver isn't covered by the boot path.

Smaller.

  • The manual now says Touch ID is offered on the M1 Air only with a kernel whose driver lets exactly those three records through.
  • The stale test message is gone.
  • The M2 Max case runs after the J313's options are gone (machine() clears them; the test asserts it), and it checks the exact line with no pin.
  • The description no longer says xart_guard=0.

Hardware. The J313 ran #506's final kernel with exactly these options:

  • three pins, identity keybag provisioned, refusals 0;
  • enrol, then 3 of 3 matches;
  • after a reboot, the enrolment restored and 2 of 2 matches.

The header check also reads that Mac's real keybag as committed, and a failed try's 52-byte header as not committed.

…thout the pins

- The set-aside of an earlier try's guard list and uncommitted keybag
  moves into lib/touchid-retry-aside, which touchid-enable calls before
  loading as before.
- enable-fingerprint's agreed branch calls it too, under the Touch ID
  lock, when the activation recorded a status that isn't ready and is not
  running now. A setup that crashed between the agreement and the load,
  or one whose spent state ends at failed, not-ready or blocked, is set
  aside so the restart sets it up again. With no status recorded the
  setup may still be running and nothing moves; the agreement and the
  status are re-read under the lock.
- On a kernel whose driver has no xart_guard_pins, the agreed branch says
  so instead of telling the owner to restart, and moves nothing.
- Tests: each recorded status, no status, an activation still running, a
  committed keybag and the unsupported kernel through the agreed branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Follow-up in a89429e. It closes the two gaps I'd left open in the description.

  • Crashed setup: a crash between the agreement and the load is now recovered. The fingerprint setup's agreed branch sets aside the spent list and uncommitted keybag (lib/touchid-retry-aside, under the Touch ID lock), so the restart sets Touch ID up again. It does this when the activation recorded a status that isn't ready and isn't running now. With no status recorded, the setup may still be going and nothing moves. The agreement and the status are re-read under the lock.
  • Older kernel: on a kernel without xart_guard_pins, the agreed branch says the kernel can't set Touch ID up on this Mac, instead of "restart", and moves nothing.

Tests cover each recorded status, no status, a running activation, a committed keybag and the unsupported kernel. The new agreed-branch case fails without the change. The full suite passes, 122 of 122, and a separate agent checked the change.

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, the recovery path looks right to me. I checked it against the unit files and the kernel's keybag format: a committed keybag is never moved, other Macs never reach the move, and on an older kernel nothing moves. That closes the crash gap, so please ignore my earlier idea of writing the agreement last. Same for my omarchy-mac/version note, since CONTRIBUTING says PRs leave it alone.

One fix: systemctl is-active never succeeds while the activation is running. omarchy-mac-touchid-activate.service is a oneshot without RemainAfterExit, so while it runs it's activating and is-active exits 3 (I checked with a oneshot unit here). That means the "while the activation runs, nothing moves" check never fires on a real Mac, and the test only passes because the stub returns 0.

To fix it, skip the move unless systemctl show -p ActiveState --value omarchy-mac-touchid-activate.service is inactive or failed, and have the stub print activating. The impact is small, since it needs a setup that was interrupted during its wait, or an activation re-run while a non-ready status is recorded. But that's exactly when the check should hold.

Smaller asks, none blocking:

  • Could the Evidence line name the #506 commit you ran on, instead of "#506's head"? The head has moved since. And if the parameter gets renamed again during #506's review, this gate needs the same change.

  • If a J313 set up on #506 later boots an older kernel, the new message is right, but omarchy-mac-touchid-load.service still runs modprobe apple-sep and the driver loads without the pins. A second ExecCondition= that skips the load on a J313 when modinfo -p apple_sep lacks xart_guard_pins would keep it off until a kernel with the pins is back.

  • The tests still pass when I break the code in these three ways:

    • dropping 3 from [13] in touchid-retry-aside (a Mac whose enclave writes state 3 would lose its keybag and list)
    • masking a failed mv with || true
    • calling touchid-retry-aside after modprobe in touchid-enable

    A keybag_file 3 116 case, a failing mv case, and a check in the modprobe stub that the list is already gone would cover them.

Once the is-active check is fixed I'm happy to approve.

…ithout the pins

- enable-fingerprint read the activation with systemctl is-active, which a
  oneshot never passes while it runs ("activating"). It now sets the state
  aside only when ActiveState is inactive or failed.
- lib/touchid-kernel-ready (new) holds the J313 check eligibility made:
  modinfo -p apple_sep must list xart_guard_pins. The load unit runs it as a
  second ExecCondition, so an M1 Air set up with the pins that boots an
  older kernel keeps the driver off until a kernel with them is back.
- Tests: the systemctl stub answers show as systemd does (activating,
  failed); a keybag in state 3 keeps its list; a guard list mv that fails
  stops the setup before the load; the modprobe stub records a list still
  in place at the load. Each of these fails on the mutation it covers.
- README and manual say the driver stays off on such a kernel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks. All addressed in b9e9b2e. A separate agent checked each fix against the code and reran the mutations.

The is-active check.

  • The agreed branch now sets the state aside only when systemctl show -p ActiveState --value omarchy-mac-touchid-activate.service prints inactive or failed.
  • The stub answers show as systemd does.
  • Tests: activating moves nothing, and failed sets the state aside.
  • Going back to is-active fails the suite, and so does counting only inactive.
  • A unit that doesn't exist prints inactive, which still counts as ended.

Smaller asks.

  • Evidence: the run was on omacom/linux-aurora@a71e98bd8. It was built as 2b718e52a, which has the same tree; the sign-off rebase gave it the new id. The head since, 56b08faee, changes only comments and docs. The description says so now, and notes that a rename in #506 means changing lib/touchid-kernel-ready.
  • Older kernel after setup:
    • The J313 check moved into lib/touchid-kernel-ready. Eligibility calls it, and omarchy-mac-touchid-load.service runs it as a second ExecCondition=.
    • On a J313 whose modinfo -p apple_sep lacks xart_guard_pins it exits 1, so the load is skipped and the driver stays off until a kernel with the pins is back. A built-in driver lists no parameters, so it is skipped too.
    • The README and the manual say so.
  • The three mutations now fail the suite:
    • [13] changed to [1]: fails "a committed keybag in state 3 and its list are kept". The enable and agreed-branch cases now run with state 1 and state 3.
    • mv … || true: fails "a list that can't be set aside stops the setup before the driver loads". An mv stub fails the guard list's move.
    • Set aside after modprobe: fails "a failed try's list and keybag header are set aside before the load". The modprobe stub records a list still in place.
    • Removing the new ExecCondition fails "the load skips an M1 Air whose kernel has no pins".

omarchy-mac/test/all passes, 122 of 122, and so do the other 23 test scripts.

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this looks good to me. The ActiveState check now matches what systemd actually reports: I checked a real oneshot shows activating while it runs, failed after a failed run, inactive after a clean run, and inactive for a unit that doesn't exist, and the stub answers the same way. The second ExecCondition only ever skips on a J313 whose apple_sep lacks xart_guard_pins, every other Mac exits 0 before modinfo runs, and an exit 1 there is a skip, not a failed unit. I redid your mutations plus a few of my own (only failed, the kernel check always passing, the J313 match broken) and each one fails the suite, which passes 122 of 122 here. One small optional fix: the comments say a built-in driver lists no parameters, but kmod 34's modinfo -p does list a built-in module's parameters from modules.builtin.modinfo, so a built-in apple_sep with the pins would pass. That's fine while linux-aurora ships it as a module, so it's only the comment that needs changing.

@malik-na

Copy link
Copy Markdown
Member Author

Closing this in favour of #202, which carries all five commits from here (d9eee0a, 62f93ab, e03a3b2, a89429e, b9e9b2e) with authorship kept. Follow-up continues there.

@malik-na malik-na closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants