Repository navigation
soc: apple: sep: gate per-user key bags on a proven capability, not the create variant - #2806
RyanTheTide wants to merge 2 commits into
Conversation
…he create variant userbag_ioctl refused per-user key bags unless profile.key_store was the variant-5 create encoding. That encoding describes how the identity key bag is created, not whether the enclave can create a NEW per-user bag. T8112 (M2) and T8122 (M3) are warm-register platforms whose SEP is handed over running and shared with macOS; their identity bag uses the variant-5 form, so they passed the Variant5 check, yet their enclave never replies to a user-bag DESIGNATE_KEYBAG. A single unanswered DESIGNATE condemns the SKS endpoint for the rest of the boot (sks_wedged), taking the whole key store down: the log shows "DESIGNATE_KEYBAG got no reply" followed by every later SKS request reporting "endpoint gone for this boot". Per-user bag create and designate are proven only on T8140 (J700) and the T6040 (J616s / M4 Pro) enclave family. Add an explicit PlatformProfile capability, per_user_keybags, true only on those, and gate userbag_ioctl and the per-user-bag ref-key / FDE paths on it instead of on the create-encoding variant. The unsupported platforms now return EOPNOTSUPP before any enclave request, so the SKS endpoint is never wedged. Touch ID and the identity bag are unaffected: neither uses userbag_ioctl. The sep KUnit suite passes (598 run, 596 passed, 2 skipped, 0 failed). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
per_user_keybags was a list of the enclaves where a user-bag create and designate had been run: true on T8140 and the T6040 family, false everywhere else. That makes every enclave nobody has tried refuse, and says nothing about why the one measured failure fails. The user-bag requests are part of the variant-5 key store; the 13.5 key store has no such requests. The one measured defect is the T8112 (J415) enclave, which returns a handle for CREATE_KEYBAG and then never answers DESIGNATE_KEYBAG, condemning the SKS endpoint for the boot. Name that defect, designate_unanswered, set it on T8112 only, and derive per_user_keybags() from the key store variant and that flag. T8122 no longer inherits the flag from the T8112 profile it extends: the unanswered DESIGNATE was measured on J415, not on an M3. T6020 on current firmware, T8122, T8132 and T8142 therefore offer per-user key bags; none of them has run a user-bag DESIGNATE yet. T8103, T6000 and T6020 on the 13.5 key store keep refusing, as does T8112. Add a KUnit case covering per_user_keybags() for every profile. Signed-off-by: Ryan <ryan@aurorasilicon.org> Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 12e80e1 (non-author, draft). No blocker in the code: against integration/aurora the only behaviour change is that the T8112 profile now refuses per-user key bags before any request is sent. One question and some text to fix before it leaves draft.
Question:
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at 12e80e168565. The new predicate still lets variant 5 imply per-user bags on unverified profiles. It then applies a T8112-specific exception, which leaves the behavior dependent on the model profile and defeats the aim of using a real capability. Require positive support from the SEP interface or a hardware-described capability before offering the operation. Please also reconcile the two different support rules described in the PR body.
Replaces #1824 (same changes, commit trailers fixed, on the current integration/aurora).
Problem
userbag_ioctlallowed per-user key bags wheneverprofile.key_store == Variant5. That field records the identity-bag create encoding, not whether the enclave can create a new per-user bag.T8112 (M2) and T8122 (M3) are warm-register platforms: iBoot hands over a running SEP that is shared with macOS. Their identity bag is created with the variant-5 form, so they passed the
Variant5check — but their enclave never answers a per-userDESIGNATE_KEYBAG. One unanswered DESIGNATE condemns the SKS endpoint for the rest of the boot (sks_wedged), so the whole key store goes down. On an M2:CREATE_KEYBAGsucceeds first and returns a handle; only theDESIGNATEof that handle hangs. The path is not gated on any boot measurement or policy, so it is independent of the boot chain state.Fix
Add an explicit
PlatformProfilecapability,per_user_keybags, true only where per-user bag create/designate is proven on hardware: T8140 (J700) and the T6040 (J616s / M4 Pro) enclave family. Gateuserbag_ioctland the per-user-bag ref-key / FDE paths on it instead of on the create-encoding variant.The capability is now
per_user_keybags(), derived from the variant-5 key store and adesignate_unansweredflag set only on T8112, the one enclave where the unanswered DESIGNATE was measured; T6020, T8122, T8132 and T8142 have no measurement of their own and now offer per-user bags until a row says otherwise.Unsupported platforms now return
EOPNOTSUPPbefore any enclave request, so the SKS endpoint is never wedged. Touch ID and the identity bag are untouched: neither usesuserbag_ioctl.Test
sep KUnit suite: 598 run, 596 passed, 2 skipped, 0 failed.
Draft: still owes a hardware row — a per-user enrol still succeeds on the Neo; the M2 and M1 Pro now refuse with
EOPNOTSUPP, no SKS wedge, Touch ID intact.Assisted-by: LLM (Claude:Opus 5.5)