Repository navigation
soc: apple: sep: harden attach-only endpoints (sse, hibe, skdl) and update specs - #3275
RyanTheTide wants to merge 10 commits into
Conversation
Keep the three endpoints without Linux consumers (sse 0x0c, hibe 0x14,
skdl 0x17) strictly attach-only while closing edge cases in diagnostics,
secret scrubbing, framing tests, and status reporting:
- Finalize diag/{sse,hibe,skdl,stac,pnon} on early bring-up failure exits
in tick_attach() so sysfs attributes do not stay stuck in "pending",
and refresh attach-only offer states if discovery arrives after
PHASE_READY (without holding the endpoints mutex).
- Wipe hibe::Prepared wrapped key, boot word and resume authorization
with volatile writes on Drop, with a KUnit test.
- Add clean-room generic-transfer framing and fail-closed reply checks to
skdl.rs matching our J473 macOS 27.2 boot captures (op 0x01 version
negotiation, op 0x06 receipt submission) with KUnit tests, while
continuing to send nothing from Linux.
- Name sse TAG_PROBE (0x03) and TAG_CONTINUE (0x04) so unsolicited probes
and continuations remain explicitly classified as Other and unanswered.
- Correct ABI and aurora-sep descriptions so skdl is not described as
silent on macOS boot, and report diag/sse_events in aurora-sep status.
Signed-off-by: Ryan Murray <[email protected]>
…and coverage gaps Bring docs/sep-endpoints/ in line with the current apple_sep driver and observed boot/sleep/shutdown traces: - Document boot, sleep/wake and shutdown expectations for sse (0x0c), hibe (0x14) and skdl (0x17), confirming attach-only causes zero SEP errors, timeouts or wake regressions across M1 Pro through M4 Pro and A18 Pro. - Add a concise full-support plan for hibe (Linux hibernation with a SEP-wrapped key and platform prerequisites) and record that sse and skdl are out of scope without Apple Pay / FairPlay consumers. - Update README.md, pnon.md and stac.md with current Linux coverage and remaining gaps on all active endpoints. Signed-off-by: Ryan Murray <[email protected]>
…and tighten docs
Finalize diag/{sse,hibe,skdl,stac,pnon} before publishing bringup_ended
and PHASE_READY on both normal and early-failure bring-up paths so readers
observing completion cannot transiently see "pending".
Also keep docs/sep-endpoints/{README,pnon,stac}.md strictly scoped to
capabilities and operations established on main (removing unmerged raw
opcode numbers and noting that earlier draft PR #1810 was closed).
Signed-off-by: Ryan Murray <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Resolve the on_discovery() conflict with the HDCP client (#3256): keep the PR's late-discovery refresh of the attach-only endpoints and main's hdcp_discovered() call. Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged Review items: there are no review comments or requested changes on this PR yet; nothing to answer. It still needs one approving review from Core or Omarchy Mac. The red CI at Conflict: one conflict, in Overlap with #3296 (xars): the two PRs conflict with each other in
Tested at
Hardware row: the PR's code is byte-identical to |
Picks up the revert of #3302 (fca33ed), whose host-test breakage came in with the previous main merge. Signed-off-by: Ryan Murray <[email protected]>
|
Merged main again at 0398001 (main fca33ed). The previous main merge brought #3302, whose host-test breakage (apple-dcp, dcpext26-startup, hardware-defaults, backlight-coldboot: undeclared Tested: |
There was a problem hiding this comment.
Verdict: Changes requested at 0398001a76c2.
Attach-only diagnostics are refreshed before finish_bringup() publishes READY. The discovery handler only refreshes an endpoint after it observes READY. An advertisement delivered after its endpoint was checked but before that phase transition can therefore leave the endpoint reported absent indefinitely. Synchronize the final diagnostic snapshot with discovery, or run a recheck after publishing READY that closes that window. Add a test that delivers discovery specifically between those two steps and verifies that no outbound messages are introduced.
on_discovery() refreshes the sse, hibe and skdl diagnostics only once it sees PHASE_READY, and bring-up checks them just before finish_bringup() stores it. An advertisement for one of them that lands between the two left its diagnostic reading "absent" for the rest of the boot. Check them once more after finish_bringup(), on the normal and both early-failure paths: an advertisement before the READY store is in the endpoint table by then, one after it takes the late-discovery refresh. The helpers only read state and send nothing to the SEP. Signed-off-by: Ryan Murray <[email protected]>
|
Pushed 27e04a2 on top of 0398001 for the App finding. `tick_exchange()` now calls `attach_idle_endpoints()` a second time, right after `finish_bringup()` stores PHASE_READY; the two early-failure `finish_bringup()` paths in `tick_attach()` do the same. An sse/hibe/skdl advertisement that arrives before the READY store is in the endpoint table by then. One that arrives after it goes through the existing on_discovery late refresh. The first call before READY stays, so readers still never see "pending". The helpers only read state and send nothing to the SEP. |
There was a problem hiding this comment.
Verdict: FIX, then re-review at 27e04a271a17
Blockers:
- Missing regression test requested in the
0398001areview: Commit27e04a271a17only modifiesdrivers/soc/apple/sep.rs(+8/-0) and does not add a test covering the discovery-vs-PHASE_READYrace window (delivering an attach-only endpoint discovery between the pre-READYattach_idle_endpoints()check andfinish_bringup(), confirming the endpoint does not stay reported"absent"and verifying that zero outbound SEP messages are introduced). Add that test so the recheck cannot regress. - Queued CI: 26 CI checks at
27e04a271a17are still queued; wait for green CI on the updated head.
Checked:
- Commit
27e04a271a17(drivers/soc/apple/sep.rs,+8/-0,MERGEABLEonmain):- Adds
this.attach_idle_endpoints()right afterthis.finish_bringup()on both early-failure paths (L3187,L3211) and the normal bring-up path (L3269). - Verified synchronization soundness: both
finish_bringup()(L3306–3308) andon_discovery()(L3488–3504) holdself.endpoints.lock()aroundself.phase.store(PHASE_READY, Relaxed)andtable.slot()/*_discovered()/self.phase.load(Relaxed) == PHASE_READY, respectively, totally ordering the two paths so an advertisement beforePHASE_READYis seen by the post-finish_bringup()recheck and an advertisement afterPHASE_READYtakes thelate_eprefresh. - Verified
sse_attach(),hibe_attach(), andskdl_attach()only read state and send no outbound SEP messages.
- Adds
Evidence
drivers/soc/apple/sep.rs: confirmedfinish_bringup()acquiresself.endpoints.lock()before storingPHASE_READYandon_discovery()readsself.phaseunderself.endpoints.lock()after updatingtableand per-endpoint discovery flags.git show --stat 27e04a271a17modifies onlydrivers/soc/apple/sep.rs(+8/-0), with no test file updated for the race window.
The previous commit reports sse, hibe and skdl again after finish_bringup() stores PHASE_READY, so that an advertisement landing between the pre-READY report and the store does not leave its diagnostic "absent". Nothing tested that ordering. Move the end-of-bring-up sequence into ready::publish() behind a small Bringup trait (attach_idle_endpoints() and finish_bringup()), and the on_discovery() late-refresh rule into ready::late_refresh(). The three tick paths and on_discovery() call them, with the same behaviour. That lets KUnit drive the production sequence with a fixture that delivers a discovery right after the pre-READY report: each attach-only endpoint ends "idle", the last report runs after READY, one discovered after READY takes the late refresh, and other endpoints never refresh. The trait gives publish() no way to send anything to the SEP. Signed-off-by: Ryan Murray <[email protected]>
|
Pushed d213236, which adds the regression test the App asked for. The end of the bring-up now goes through |
There was a problem hiding this comment.
Verdict: HOLD at d213236f — the ready::publish() / ready::late_refresh() refactor and apple_sep_ready KUnit regression suite cleanly resolve the 27e04a27 finding; awaiting queued CI, the exact-head J616s boot row, and maintainer sign-off before merge.
Blockers:
- Complete the queued CI checks at
d213236f. - Post the exact-head J616s boot receipt at
d213236f(aurora-sep statusPASS withsse/hibe/skdl=idle).
Checked:
- Audited the
27e04a27..d213236fdelta acrossdrivers/soc/apple/ready.rs(+170/-0) anddrivers/soc/apple/sep.rs. ready::publish()preserves the exact runtime ordering across all three bring-up paths (normal tick withdiag::log_summary(&this.dev)inbefore_ready, plus both early-failure paths): report attach-only endpoints ->before_ready()->finish_bringup()(storingPHASE_READYunderself.endpoints.lock()) -> re-report attach-only endpoints, withBringupexposing no SEP TX capability.ready::late_refresh()preserves theon_discovery()late-refresh gating (EP_SSE | EP_HIBE | EP_SKDLonly whenPHASE_READYwas observed underself.endpoints.lock()).apple_sep_readyKUnit suite covers all 4 cases: discovery injected between pre-READYreport andfinish_bringup(), discovery duringbefore_ready, discovery afterREADYtaking late refresh, and non-attach-only endpoints (EP_STAC,EP_SKS) never refreshing (344/344 SEP KUnit and 23/23 host tests passing).- DCO
Signed-off-by:present ond213236f; no Apple material or policy issues.
Evidence
27e04a27..d213236f:drivers/soc/apple/ready.rs(+170/-0),drivers/soc/apple/sep.rs(+24/-37).- CI at review time: 25 queued, 7 skipped (
0failures;readinesscancelled on push).
#3237 made finish_bringup() take the key-store outcome and end the keystore/bringup diagnostics after the PHASE_READY store, so trusted-key callbacks see -EAGAIN until bring-up has finished on every exit. This branch moved finish_bringup() behind ready::Bringup so ready::publish() can recheck the attach-only endpoints after the store. Keep both: Bringup::finish_bringup() and ready::publish() carry keystore_open/keystore_only through to #3237's finish_bringup(), the early-failure exits pass false/false as main does, and the summary line follows publish() because it reads the key-store state set there. A new apple_sep_ready case checks the outcome reaches finish_bringup(). Signed-off-by: Ryan Murray <[email protected]>
|
Forward-merged main (with #3237) into this branch as ea38341, no force push. The conflict was in the SEP bring-up exits in |
There was a problem hiding this comment.
Verdict: HOLD at ea383417 — the main forward-merge conflict resolution with #3237 is clean and code-ready; awaiting hosted CI completion and the exact-head J616s hardware boot row.
Blockers:
- Wait for hosted CI checks at
ea383417(apple-build,kunit,host-tests,pr-text,readiness) to complete green. - Post the exact-head
ea383417J616s boot row verifyingaurora-sep statusPASS withsse/hibe/skdlidle and no regressions.
Checked:
- Audited the
mainmerge (ea383417, DCOSigned-off-by:present,MERGEABLE) resolving the#3237conflict indrivers/soc/apple/sep.rsanddrivers/soc/apple/ready.rs:ready::Bringup::finish_bringup(&self, keystore_open: bool, keystore_only: bool)preserves#3237's exact lock-scoped ordering (self.endpoints.lock(),PHASE_READYRelease,diag::keystore_open()/diag::keystore_ended()/diag::bringup_ended(),self.trusted_ready.notify_all()).- Both early-failure exits (no endpoints advertised and
xarmOOL buffer registration failure) pass(false, false)throughready::publish()afterfinalize_failed_bringup_endpoints(), matchingmainwhile still finalizing per-endpoint diagnostics. - The normal exit passes
(keystore_open, keystore_only)toready::publish(), runsdiag::log_summary(&this.dev)afterward (matchingmainso the summary reads the key-store state written infinish_bringup()), and retains the pre-/post-PHASE_READYattach-only endpoint recheck andon_discovery()late refresh with zero SEP TX. - Added the 5th
apple_sep_readyKUnit testthe_key_store_outcome_reaches_finish_bringup()covering all four(keystore_open, keystore_only)combinations.
Evidence
drivers/soc/apple/ready.rs:Bringup::finish_bringup(bool, bool),publish()forwarding(keystore_open, keystore_only), and 5/5apple_sep_readyKUnit cases.drivers/soc/apple/sep.rs: L3191–3195, L3213–3217, L3259–3270, L3742–3767 verified againstmain#3237semantics.- Reported local verification at
ea383417: SEP KUnit 355/355 (apple_sep_ready5/5,apple_sep_trusted7/7,apple_sep_refkey_trusted2/2),run-host-tests.py --only sep23/23,test_trusted_readiness.py+test_refkey_seal_admission.py8/8 (plain and-O).
Signed-off-by: Ryan Murray <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
|
I merged current |
There was a problem hiding this comment.
Verdict: MERGE at 7b72c8e39eaf
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks and the J616s SEP boot row showing the three attach-only endpoints idle.
Follow-ups (not blocking): hosted checks; J616s SEP boot row with attach-only endpoints idle
What: Harden the three attach-only Apple SEP endpoints (
sse0x0c,hibe0x14,skdl0x17) inapple_sepandaurora-sepwithout changing their send-nothing runtime policy, and updatedocs/sep-endpoints/with observed boot/sleep/shutdown contracts, thehibehibernation plan, and current coverage gaps across all active SEP endpoints.Tested: Exact PR head
acfada95782e:sep.kunitconfig,LLVM=1): 321/321 PASS (apple_sep_sse6/6,apple_sep_hibe4/4,apple_sep_skdl5/5,apple_sep_pnon7/7,apple_sep_stac8/8).tools/aurora-sep/tests, 19 modules): 130/130 PASS (python3 -O: 28/28 PASS on status/diag/store/identity suites).tools/asahi/run-host-tests.py --only sep): 23/23 PASS;include/uapi/linux/apple-sep.hABI static-assert check PASS.scripts/checkpatch.pl --strict --git aurora/main..HEAD: 0 errors, 0 warnings, 0 checks across all 3 commits.J616s,T6040/J616s) at exact PR headacfada95782e(7.3.0-aurora-sepatt2+,fleet89-based SEP trial build): clean boot (Enforcing, 0 failed units, 0 AVC), 12 endpoints ready (sse=idle,sse_events=0,hibe=idle,skdl=idle,pnon=read,stac=online,unhandled_messages=0,xarm_failures=0,log-errors=0,hwrng32B live), updatedaurora-sep statusPASS (28 pass, 0 fail, reportingPASS sse-events 0), 2/2s2idle(rtcwake -d rtc1 -m freeze -s 10) cycles PASS (sleeps=2,log-errors=0,sse_events=0), restored and verified on7.3.0-aurora-fleet89.J473,T8112/J473, no built-in Touch ID sensor) at exact PR headacfada95782e(7.3.0-aurora-sepatt2+): clean boot (Enforcing, 0 failed units, 0 AVC), 12 endpoints ready (sse=idle,sse_events=0,hibe=idle,skdl=idle,pnon=read,stac=online,unhandled_messages=0,xarm_failures=0,hwrng32B live), 2/2s2idle(rtcwake -d rtc1 -m freeze -s 10) cycles PASS (sleeps=2,sse_events=0,unhandled_messages=0,avc=0), restored and verified on7.3.0-aurora-fleet89.diag/*and kernel journal audit across 7 Macs (J616sM4 Pro,J713M4 Air,J615M3 Air,J413M2 Air,J473M2 Mac mini,J316sM1 Pro,J700A18 Pro): 0 errors, timeouts, or unhandled messages from attach-onlysse/hibe/skdl.Risk: two-way · all Macs with Apple SEP (
apple_sep).sse,hibe, andskdlcontinue to send zero messages to the SEP; changes are confined to bring-up diagnostics finalization beforePHASE_READY, late-discovery offer refresh,hibe::Preparedvolatile drop wiping, unused clean-roomskdlframing/KUnit tests,aurora-sep statusreporting, and documentation.Not yet:
hibeLinux hibernation with a SEP-wrapped image key (gated on Apple-silicon hibernation support and cold coprocessor firmware restore; 4-stage plan documented indocs/sep-endpoints/hibe.md).sse(Apple Pay / Wallet Secure Element pairing) andskdl(CoreKDL Apple Pay / FairPlay kernel-extension deny list) clients — out of scope for Linux without those consumers.pnon2-4 page layout (0x02020404, draft PR soc: apple: sep: read the pnon digest on the two-to-four-page SEPs #2810) andstacMagic Keyboard with Touch ID client (earlier draft PR Magic Keyboard with Touch ID: Touch ID channel on USB, trusted-accessory client and pairing relay #1810 closed; needs per-device interface and lifecycle wiring).Details
Code changes (
27e14fb8d6ac3d,acfada95782e)drivers/soc/apple/sep.rs:attach_idle_endpoints()and addfinalize_failed_bringup_endpoints()so both normal bring-up and early error exits intick_attach()(zero advertised endpoints, orxarmOOL registration failure) finalizediag/{sse,hibe,skdl,stac,pnon}before publishingbringup_endedandPHASE_READY, preventing sysfs attributes from sticking or transiently reading"pending".sse/hibe/skdloffer states inon_discovery()if late discovery arrives afterPHASE_READY, after releasing theendpointsmutex.skdlcomment to reflect that macOS sends boot version/receipt messages while Linux intentionally sends nothing.drivers/soc/apple/hibe.rs:Prepared::wipe()andimpl Drop for Preparedusing volatile writes (image::wipe+write_volatile) so wrapped key, boot word, and resume authorization bytes are scrubbed on drop, with KUnit coverage (prepared_material_is_wiped).drivers/soc/apple/skdl.rs:skdlstrictly attach-only (sends nothing from Linux).#[allow(dead_code)]generic-transfer (tag = 0xfc) boot framing matching observed J473 macOS 27.2 boot words (op 0x01protocol version,op 0x06receipt submission) and fail-closed reply classification/validation, with 3 new KUnit tests.drivers/soc/apple/sse.rs:TAG_PROBE(0x03) andTAG_CONTINUE(0x04) while keeping both explicitly classified asArrival::Otherand unanswered.Documentation/ABI/testing/sysfs-driver-apple-sep&tools/aurora-sep/:skdlABI andaurora-sepdescriptions.diag/sse_eventsinaurora-sep status(PASSon 0,INFOon >0) with unit test coverage intest_aurora_sep_status.py.Documentation changes (
76a26aef8fb989,acfada95782e)docs/sep-endpoints/{README,sse,hibe,skdl,pnon,stac}.md:sse,hibe, andskdl.hibeand explicit out-of-scope verdicts forsseandskdl.README.md,pnon.md, andstac.mdwith currentmaincoverage and remaining capability gaps across active endpoints.