Skip to content

soc: apple: sep: userbag: designate FDE keys under the user's bag - #2999

Draft
Alyx-ML wants to merge 1 commit into
aurora-silicon:mainfrom
Alyx-ML:aurora/sep-fde-user-bag
Draft

Alyx-ML wants to merge 1 commit into
aurora-silicon:mainfrom
Alyx-ML:aurora/sep-fde-user-bag

Conversation

@Alyx-ML

@Alyx-ML Alyx-ML commented Nov 23, 2026

Copy link
Copy Markdown

Part of the #2755 split. Draft: it needs a hardware create and unseal row.

Summary

-FDE designation: the identity bag's handle (uid 1000 collided)
+FDE designation: -(USER_BAG_BASE + uid), as every other bag_designation() caller

FDE records made before this change sit under the wrong bag and must be made again. The FDE
ioctls are a design draft, not a stable ABI.

Evidence

  • Before: a host rustc --test copy of the designation math gives uid 1000 the identity bag's
    handle.
  • After: it gives KEYBAG_UNLOCK's handle for MIN_UID..MAX_UID and refuses MAX_UID + 1. KUnit
    fde_uses_the_user_bag in SEP source checks: passed, Apple build and KUnit, SEP source checks.
  • Needed before merging: create an FDE record and unseal it on a Mac, before and after.

Merge Danger

Door: one-way

Blast Radius: existing FDE records

Records made with the old designation are orphaned.

Assisted-by: LLM (Claude:Opus 5.5)

SEP_BIO_FDE_CREATE, FDE_SEAL and FDE_UNSEAL designated the key store user
as the raw uid. Every other user-bag ioctl designates USER_BAG_BASE + uid
(bag_designation), which is the bag SEP_BIO_KEYBAG_UNLOCK opens with the
user's password. The FDE work landed in parallel with the offset and was
never moved over.

The result: uid 1000 sealed its disk secret under designated user 1000,
which is the Linux identity bag (trusted keys, the machine ref-key, Touch
ID's catacomb user), not under the bag its password unlocks. Other uids
pointed at a bag that KEYBAG_UNLOCK never opens, so the uAPI promise
"opens it only while the bag of 'uid' is unlocked" did not hold.

Use bag_designation() in parse_fde() and FDE_CREATE. It also brings the
MAX_UID bound, so the separate i32::MAX check goes. Records made before
this change sit under the wrong bag and must be created again; the FDE
ioctls are a design draft, not a stable ABI.

The ref-key doc comment now names the real outer handle.

Verified: a host rustc --test copy of the designation math shows the old
code gave uid 1000 the identity bag's handle and the new code gives the
same handle as KEYBAG_UNLOCK for MIN_UID..MAX_UID, refusing MAX_UID + 1.
A new KUnit case, fde_uses_the_user_bag, asserts the handle is
-(USER_BAG_BASE + uid). The kernel Rust code was not compiled here.

Not run on hardware. Creating an FDE record and unsealing it again on a
Mac, before and after this change, is needed before this is merged.

Signed-off-by: Alyx-ML <256263590+Alyx-ML@users.noreply.github.com>
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