Skip to content

soc: apple: sep: retry a failed sensor bring-up before a verify (Touch ID after resume) - #339

Merged
RyanTheTide merged 2 commits into
aurora-wipfrom
j700/sep-verify-retry
Oct 17, 2026
Merged

RyanTheTide merged 2 commits into
aurora-wipfrom
j700/sep-verify-retry

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

On the MacBook Neo, the first Touch ID verify after a system suspend sometimes failed with "the sensor did not come back online". fprintd then ended the verify, and the lock screen dropped its fingerprint prompt even though the sensor worked. It was seen on 2026-10-16, when the lid was reopened after a sleep.

Cause

Fix (2 commits)

  1. Say why the status after registration was unusable. It distinguishes an SPI transfer failure from an all-zero (silent) sensor status, and logs the timing. This is log only.
  2. Retry a failed sensor bring-up before a verify.
    • Attach's bounded retry moves into a helper, and a verify uses it too, on the same nonce-session profiles.
    • A verify checks before each new attempt whether it is still wanted, so a cancel, a close or a suspend never waits for further attempts.
    • Authentication is unchanged: every attempt still needs the enclave to accept the session commit, and the match is the same. Other profiles keep their single attempt.

Testing

  • Review: APPROVE, independent. One NIT: a MAINTAINERS F: tools/aurora-sep/ entry, left for a later tidy-up.
  • Mock tests: tools/aurora-sep/tests/test_verify_bringup.py runs the verify and attach code with mocks, and fails without the change.
  • Merged onto current aurora-wip 3aecdf80:
    • the merge is clean (2 files);
    • the SEP Rust KUnit (apple_sep_registration, apple_sep_transfer) passes on the merged tree.
  • MacBook Neo: 7.1.12-aurora-sep-verify-retry-gaf1c264b6, a published-config build with 0 warnings, booted one-shot.
    • 5/5 cycles of a 15 s RTC s2idle followed by fprintd-verify:
      • 5 stage-2 re-registrations in 56–63 ms;
      • 0 "the sensor did not come back online", 0 failed bring-up attempts, 0 unusable status reads;
      • 0 EBUSY, transfer-failure or WARN/BUG lines.
    • fprintd listed the same 3 fingers before and after.
    • The default kernel reproduced 20/20 registrations in the same test. This sample doesn't reach the incident's 1-in-4 rate on either kernel; the retry is the guard for the rare case.
  • Follows after merge: an attended lock-screen and sudo check after a lid close and reopen.

🤖 Generated with Claude Code

…sable

After a sensor registration the status is read again before the patch
acknowledgment is trusted. When that read is unusable the bring-up stops
with "status unavailable after registration", which covers two different
failures: the SPI transfer failed, or the sensor answered with an
all-zero (silent) status. They point at different causes, the bus or
the sensor, and the line does not say which, nor how long after
power-on it happened.

Name which one it was and the time since the sensor was powered on, as
the other registration steps already do. The start of the message is
unchanged, so existing log searches still match.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Every verify powers the sensor up and registers it with the enclave
again before it captures. The first verify after a system suspend on a
MacBook Neo failed that way: the re-registration completed, the status
read straight after it was unusable, and the verify ended with "the
sensor did not come back online". libfprint reports that as an error,
so fprintd ends the verify and the lock screen drops its fingerprint
prompt although the sensor works.

The first registration after boot fails in the same ways now and then,
and commit 6c39413 ("soc: apple: sep: Retry a failed attach-time
sensor bring-up") recovers it by starting again from a power-cycled
sensor, which clears the enclave's registration before the new one. The
verify path never got that retry, and the first verify after a suspend
is where a failed re-registration has been seen: in the kernel logs on
record, re-registrations that did not follow a suspend have not failed,
and one of the four that first followed one failed like this. Before
commit 4db9a38 ("soc: apple: recheck sensor status after SEP
registration") the same verify fell to state 9 instead.

Move attach's bounded retry into a helper and use it for a verify too,
on the same nonce-session profiles. A verify asks before each new
attempt whether it is still wanted, so a cancel, a close or a suspend
does not wait for further attempts. Other profiles keep their single
attempt.

Attempts cost tens of milliseconds each and are logged. Authentication
is unchanged: each attempt still needs the enclave to accept the
session commit, and the match itself is the same.

tools/aurora-sep/tests/test_verify_bringup.py runs the verify and
attach code with mocks; it fails without this change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit b659856 into aurora-wip Oct 17, 2026
RyanTheTide added a commit that referenced this pull request Oct 17, 2026
Bring the 7.2.10 assembly to the tree of the canonical top-up #5
assembly 1c824ed, stacked on top-up #4 5043778 so that it is
a fast-forward of the published branch. The second parent is that
canonical assembly; the tree is identical to it.

Ported from aurora-wip, each with cherry-pick -x and its original
author:
- #338 tipd lost IRQ (5): never leave CD321x interrupt events
  unacknowledged, recover from a failed partner identity read, keep
  SN201202x events unhandled while it sleeps and wake it when suspend
  fails, and the KUnit race fix of the IRQ test (170-usb).
- #339 Touch ID verify retry (2): say why the sensor status after
  registration was unusable, and retry a failed sensor bring-up before
  a verify (100-sep).
- #340 USB and Bluetooth wake v4.1 (30): AIC wake (010-soc); xHCI,
  DWC3 and hub suspend-to-idle wake with their KUnit tests (170-usb);
  MT7932 Bluetooth wake and MSI wake for Apple PCIe (080-radio); the
  apple-dcp DWC3 wake model (200-dcp); the tools/aurora-wake regression
  tools (900-config-tooling).
- #341 apple-dcp selftests for the tipd lost-IRQ helpers (200-dcp).
- batch1 backlog: rust-clippy (4; 070-audio, 210-gpu), boot-warnings
  (3; 200-dcp), and the 4 harden-all commits not yet carried (010-soc
  qspi resume, 070-audio AOP wrapped-entry test, 200-dcp start
  completion). kunit-parsers, spi-apple-cs and the other 34 harden-all
  commits were already in the topics, including the AOP ring fix that
  top-up #4 brought; it is not duplicated.

Not ported: 3132675, superseded on 7.2.10 by b69728b
("selftests: apple-dcp: Follow the 7.2.10 driver boundaries").

Adaptations, each with a [ryan: ...] note in its commit:
- the new tipd KUnit tests take the CD321x and SN201202x data from
  the exported tipd_hw_variants[] table of 7.2.10;
- the #341 lifecycle.py import also keeps ATC_POST_TUNABLE;
- drm/asahi statistics style without the driver.rs part, which 7.2.10
  already has;
- the Rust doc example refresh only for KVec and Drain: iosys_map.rs,
  the old IoMem example and declare_flags_type!() are gone in 7.2.10;
- "Do not arm the core interrupt for wakeup" split between 170-usb and
  200-dcp.

New: 11e0ce6 ("usb: typec: tipd: cd321x: Don't race the resume
read in the sleep retry test").

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the j700/sep-verify-retry branch October 17, 2026 09:34
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