Skip to content

soc: apple: sep: let a password clear Touch ID's failed attempts - #1143

Merged
RyanTheTide merged 5 commits into
integration/aurorafrom
fix/sep-touchid-password-clears-count
Nov 8, 2026
Merged

RyanTheTide merged 5 commits into
integration/aurorafrom
fix/sep-touchid-password-clears-count

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Stacked on #1134. Retarget after it merges.

On macOS a password typed after missed Touch ID attempts clears the enclave's failed-attempt count, so the next prompt again has five attempts. The Linux re-arm did nothing unless Touch ID was already locked. After #1134's limits (3 per prompt, 5 to a lockout), three misses in sudo followed by the password left only two attempts for the next prompt.

This commit changes the re-arm when Touch ID is not locked: it clears the host's failed-attempt count and its record. The full enclave re-arm stays for a real lockout.

The userspace half is aurora-silicon/aurora-sep-userspace#6 (commit "touchid-rearm: let a password clear pending failed matches"). With it, the helper also verifies the password and re-arms when failures are pending. It still answers at once, checking nothing, when no failures are pending.

Tests

  • checkpatch: clean.
  • W=1 drivers/soc/apple: 0 warnings.
  • Helper make check: 12/12 pass, including 2 new tests.
  • Hardware: none yet. This is not in the morning test kernel (tid26).

🤖 Generated with Claude Code

On macOS a password typed in a Touch ID prompt verifies the user's key
bag in the enclave, and that clears the failed-attempt count: after a
missed prompt and a password, the next prompt again has five attempts
before Touch ID locks.

The driver's re-arm did nothing unless Touch ID was already locked, so
misses before a password still counted afterwards, and two more misses
in the next prompt could lock Touch ID. When the re-arm comes while Touch
ID is not locked, clear the host's failed-attempt count and its record.
The full enclave re-arm stays for a real lockout.

The re-arm helper calls this after a verified password; it needs to do
so when failed attempts are pending as well as when Touch ID is locked.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
A password typed after a missed Touch ID prompt cleared only the host's
failed-attempt count. The enclave keeps its own count of completed
no-matches and locks Touch ID at five; a password clears that count on
macOS, where the key bag verification it triggers resets it. Here the
enclave's count stood, so three misses, a password and two more misses
locked Touch ID while the host reported two of five.

When failed attempts are pending, run the enclave side of a re-arm as
well: the key bag verification, a new match credential and the lockout
record save, the same steps that end a real lockout.

Do not wait for the sensor lock to do it. A verify holds that lock for
its whole wait for a touch, and a lock screen takes the password while
one waits; the re-arm call, and with it the password authentication,
would stall until the capture timed out. Clear the host's count at once
and, when the lock is taken, owe the enclave's clear to the start of the
next authentication. A match clears both counts and drops what is owed.

The re-arm helper must call the re-arm whenever failed attempts are
pending, and calling it after every password should cost nothing. Say so
in the lockout state's former reserved word: SEP_BIO_LOCKOUT_FLAG_EVERY_
PASSWORD tells it that this driver's re-arm never waits for a capture
while Touch ID is not locked. An older driver's re-arm does wait, so the
helper keeps to locked-only calls there.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

TID10: added b4dace5 ("clear the enclave's failed attempts on a password too"). It fixes two things in this PR:

  • Enclave count: a password while not locked cleared only the host's count. The enclave kept its own 5-count (a password's key bag verification clears it on macOS), so 3 misses + password + 2 misses still locked Touch ID. The not-locked path now runs the same enclave re-arm when failures are pending.
  • Blocking: the re-arm took the sensor lock, which a verify holds for its whole wait for a touch. With the helper calling it whenever failures are pending, a GNOME lock-screen password typed while gdm-fingerprint waits would block in PAM for up to the 10 s request timeout. The re-arm now uses try_lock; if a capture holds the lock, it clears the host count at once and clears the enclave count at the start of the next authentication.

The new SEP_BIO_LOCKOUT_FLAG_EVERY_PASSWORD (in the lockout state's former reserved word) tells the helper this re-arm never waits. Older kernels keep locked-only calls (aurora-sep-userspace#6 e11bc73).

Gates: checkpatch 0/0, W=1 0, KUnit apple_sep* 176/180 (4 = base host_store). Runs in test kernel 7.3.0-aurora-fleet22-tid27 (Neo no-finger gate next).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware finger test PASSED on the MacBook Neo, 2026-11-08 ~14:20, by Ryan on kernel 7.3.0-aurora-fleet22-tid27 (#1087 + #1134 + #1143), libfprint aurora10, aurora-touchid-rearm 1-2.

  • Kernel log confirms password re-arm/clear (7 events), the lockout at 5 failed attempts (3), and an enrolment completed.
  • Evidence: traces/touchid/20261108-touchid27-finger.

The lift-gated re-arm, the retry limits, the lock states and the
password re-arm read nothing from the platform profile, and the lift
detector was only tested with statuses from the J700's 0x3356 sensor.
The M1, M1 Pro/Max, M2, M2 Pro/Max and M3 Macs carry the 0x3352 part.

Add two KUnit cases:

- apple_sep_sensor_status: for every Mesa revision the driver knows,
  idle, armed, finger-on, frame-ready and needs-patch statuses decode
  to the same finger-on/finger-off verdict, and the idle status reads
  the revision back.
- apple_sep_profile: every Mac with a built-in sensor (J313, J316s,
  J316c, J414s, J414c, J413, J415, J613, J615, J614s, J616s, J616c,
  J713, J700) selects a profile whose sensor is one of those revisions,
  so the shared path decodes it.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Every start on the M2 (fleet30 + this series) logged a new boot warning:
"LOAD_LOCKOUT refused the saved lockout record (0x8002 ...)". The enclave
refuses a record older than the restored catacombs, and the host record
already carries the failed-attempt count in that case, so nothing is
lost and nothing needs the user's attention. Before this series the same
answer was taken without a warning.

Log it once at info level, next to the restore outcome, so the boot log
stays free of warnings. Why the enclave refuses the record at start is
tracked separately.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide changed the base branch from fix/sep-touchid-macos-policy to integration/aurora November 8, 2026 04:36
@RyanTheTide
RyanTheTide merged commit 14d64c3 into integration/aurora Nov 8, 2026
2 checks passed
@RyanTheTide
RyanTheTide deleted the fix/sep-touchid-password-clears-count branch November 8, 2026 04:37
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged after the cross-Mac gate. The Touch ID path here has no SoC gating, and it now runs the same on every Touch ID Mac:

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.

1 participant