Repository navigation
soc: apple: sep: open the xART guard's list per access - #1264
Merged
RyanTheTide merged 1 commit intoNov 10, 2026
Merged
RyanTheTide merged 1 commit into
RyanTheTide merged 1 commit into
Conversation
RyanTheTide
reviewed
Nov 9, 2026
RyanTheTide
left a comment
Contributor
There was a problem hiding this comment.
The commit (1106742) has no Signed-off-by: line, so it can't be taken as is. Could you add yours (git commit --amend -s) and push again?
On the change itself: opening the list per access looks right. size, read_exact, sync and sync_parent only need a read-only descriptor, write_all uses open_writable_existing so only Guard::open() can create the file, and an fsync on a fresh descriptor still flushes and reports earlier writeback errors. Losing the file mid-boot fails adoption with ENOENT, which refuses the write as intended.
The xART guard opens /var/lib/aurora-sep-xart-owned.bin read-write when the xART store is set up and keeps it in the guard, which lives as long as the store: until the device is unbound. Nothing unbinds it before a reboot, so the kernel holds a writer on the file system that holds /var/lib until power-off. systemd-shutdown's read-only remount of that file system then fails with EBUSY and it stays read-write. The host-state store has the same problem, and aurora-silicon#583 fixes that one. Both files have to be closed before the file system unmounts cleanly: on a J616s with the host-state store fixed, the root still was not remounted read-only at shutdown, and every boot still replayed the ext4 journal. Open the list for each access instead: read-only for size, reads and syncs, existing-only for writes. Only Guard::open() creates it. The create-and-adopt rule in with_file() is unchanged: the directory is still flushed before a list is adopted. The list format and the KUnit tests, which use an in-memory file, are unchanged. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com> Assisted-by: LLM
Contributor
Author
|
Replaced by #1337: the same diff with my |
jgoyvaerts
force-pushed
the
pr/sep-xart-owned-per-access
branch
from
November 9, 2026 14:23
1106742 to
688c134
Compare
RyanTheTide
merged commit Nov 10, 2026
1ebeafd
into
aurora-silicon:integration/aurora
8 checks passed
This was referenced Nov 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The xART guard keeps
/var/lib/aurora-sep-xart-owned.binopen read-write from the kernel until power-off. Like the host-state store in #583, that keeps a writer on whatever file system holds/var/lib, so it can't be remounted read-only at shutdown. This opens the list only while it is being used.What happened
Guard::open()opens the list withopen_hostand keeps the file inGuard.file. The guard belongs to the xART store, which the SEP device holds until it is unbound, and nothing unbinds it before a reboot. Killing every process at shutdown doesn't close a file the kernel opened.#583 says the host-state store is the only file that stays open. That holds where the guard is off, but wherever the guard is on (level 1 here:
xART guard level 1: 11 session records exist, 0 created by Linux), the list stays open too. Both fixes are needed before the file system unmounts cleanly.On this machine
/var/libis on the root (ext4), and every boot since the SEP driver arrived replayed the journal (EXT4-fs (nvme0n1p5): recovery complete). A final-shutdown hook recorded the state after systemd-shutdown's unmount loop:/at the endNot all file systems unmounted, 1 left.rw,needs_recoverysetAll filesystems unmounted.ro, cleanIn both captures the only process left was systemd-shutdown itself, which held no file on
/.The change (
xart_guard.rsonly)HostListFileimplementsListFileand opensOWNED_PATHfor each access, then closes it: read-only forsize,read_exact,syncandsync_parent, andopen_writable_existingforwrite_all.Guard::open()still callsopen_host, but only to create the list if it is missing. That handle is closed at once.with_file()(the directory is flushed before a list is adopted), the list format, and the KUnit tests, which use their in-memoryMemFile.ENOENTand the write is refused, which is the guard's safe direction.fsyncthrough a new descriptor still flushes the earlier writes and reports a writeback error no descriptor has seen.sep_store_sync_parentonly uses the file's path, so a read-only handle works.This doesn't conflict with #583: different files, and each works on its own.
Tested
/var/lib. 7.3.0, with this change and a host-state fix equivalent to soc: apple: sep: open the host-state store only for each operation #583:/clean, with no journal replay.Touch ID: restored 1 enrolled identity/identities; enrolment survived reboot), the unlock preflight passed, and the SEP logged no errors./was still read-write at the end of shutdown, as shown in the table.90d2b1ef362):xart_guard.rs,shim.rsandstore_shim.care byte-identical to the tree I tested.apple-sep.obuilds with no warnings, also withCONFIG_KUNIT=yandCONFIG_APPLE_SEP_KUNIT_TEST=y.🤖 Generated with Claude Code