Skip to content

Boot the Secure Enclave read-only at boot so M1-family microphones work - #90

Open
malik-na wants to merge 12 commits into
mainfrom
mac/sep-read-only-microphone
Open

malik-na wants to merge 12 commits into
mainfrom
mac/sep-read-only-microphone

Conversation

@malik-na

@malik-na malik-na commented Nov 4, 2026

Copy link
Copy Markdown
Member

What

On M1, M1 Pro and M1 Max Macs the built-in microphones sit on the Secure Enclave's data path. Until the enclave boots, every capture is ~40 ms of filter transient followed by exact zeros, and dictation reports "No speech detected". The installed linux-aurora 7.2.11.aurora14-1 builds the driver as a module (CONFIG_APPLE_SEP=m) and the J313 device tree enables sep@242400000, but the module exports no alias, so nothing loads it on a normal boot (omacom/linux-aurora#141, fixed by the unmerged omacom/linux-aurora#180). The package's omarchy-mac-touchid-load.service only runs on the owner's Touch ID record, and touchid-eligibility reports unsupported:m1-family on these Macs, so that path is closed to them.

This adds omarchy-mac-sep-load.service, which boots the enclave read-only at every boot on the M1 family:

  • omarchy-mac/vendor/systemd/system/omarchy-mac-sep-load.service: oneshot after local-fs.target and the Touch ID status, before display-manager.service; skipped while /etc/omarchy-mac/touchid-on exists, since the Touch ID load owns the driver and its options then; waits for /dev/disk/by-partlabel/iBootSystemContainer with udevadm wait --timeout=20 the way the Touch ID load does (the driver opens it as it probes and does not retry); runs modprobe apple-sep xart_writes=0 provision_keybag=0.
  • omarchy-mac/vendor/systemd/system/multi-user.target.wants/omarchy-mac-sep-load.service: the wants link that pulls it in, as the Touch ID units are.
  • omarchy-mac/lib/sep-for-microphone: the unit's ExecCondition. Reads only the device tree: exit 0 on an apple,t8103, apple,t6000 or apple,t6001 root whose soc/sep@* node has compatible apple,sep and is enabled; 1 anywhere else, so later Macs and a tree that disables the node never load it.
  • omarchy-mac/test/sep-microphone-test.sh: stages the package, checks the unit's lines (read-only options, the Touch ID condition, the link wait, no device dependency, the ordering), runs the helper against fixture trees (each M1 board with the node enabled, without a status and disabled; M2, M2 Pro and M3 Air boards; no node; another platform; no tree), and runs systemd-analyze verify --root and systemd-analyze condition.
  • omarchy-mac/README.md: documents the unit; version 0.2.4 → 0.2.5 with omarchy-mac/version.
  • mac-manual/content/12-hardware.md, mac-manual/content/04-security.md: one sentence each on the read-only boot.

Never xart_writes=1 or provision_keybag=1: linux-aurora's tools/aurora-sep/XART-SAFETY.md (on #180) states that xart_writes=0 provision_keybag=0 is read-only operation: the enclave boots, Touch ID stays off, and the xART store shared with macOS is never written. The read-only driver leaves Linux-only state in /var/lib/aurora-sep-host-state.bin and exposes /dev/sep-bio; omarchy-mac-touchid-activate.service is conditioned on the owner's record, so nothing opens it. Once #180 ships, the module autoloads read-only on its own and this unit becomes a no-op; it can go then.

Evidence

Diagnosed and confirmed on a MacBook Air M1 (J313, apple,t8103, macOS 13.5 firmware) on 2026-11-04:

  • modinfo apple-sep lists no alias: line; /proc/device-tree/soc/sep@242400000 reads compatible = "apple,sep", status = "okay".
  • Before: every recording ~40 ms of transient then zeros.
  • sudo modprobe apple-sep xart_writes=0 provision_keybag=0 logged xART ... writes disabled, TZ0 accepted, IMG4 acknowledged, 7 endpoints; the microphone immediately delivered live audio at about -42 dBFS and Superwhisper transcribed speech correctly.

Verified

  • omarchy-mac/test/all: 119 checks pass, including the new test.
  • systemd-analyze verify --root on the staged unit (systemd 262): clean.
  • bash -n on the helper and the test; .github/scripts/check-scope and check-architecture-gates pass.
  • lib/sep-for-microphone exits 0 on the J313 above.

Not verified

  • No reboot: the unit has not run on a real boot yet. It was not installed into /etc or /usr on the test Mac; the driver was loaded by hand with the same options.
  • Only tested on apple,t8103. M1 Pro and M1 Max (t6000, t6001) are gated the same way; the helper also requires their tree to enable the SEP node.
  • The manual was not built locally (no markdown module); CI builds it.

🤖 Generated with Claude Code

On M1, M1 Pro and M1 Max Macs the built-in microphones sit on the Secure
Enclave's data path: until the enclave boots, every capture is about 40 ms
of filter transient followed by exact zeros, and dictation reports no
speech. The installed linux-aurora (7.2.11.aurora14-1) builds the driver as
a module (CONFIG_APPLE_SEP=m) and the J313 device tree enables the
sep@242400000 node, but the module exports no alias, so nothing loads it on
a normal boot (omacom/linux-aurora#141; #180 restores the alias and boots the
enclave without the xART store, which makes this unit redundant once it
ships). The package's Touch ID load only runs on the owner's record, and
touchid-eligibility reports unsupported:m1-family on these Macs, so that
path is closed to them.

omarchy-mac-sep-load.service, pulled in by the package's multi-user.target
wants link, runs after local-fs.target and the Touch ID status and before
the display manager, so the session's first capture already works. Its
condition, lib/sep-for-microphone, reads only the device tree: an
apple,t8103, apple,t6000 or apple,t6001 root whose soc/sep@* node is
enabled. Later Macs record without the enclave and never load it here, and
a Mac whose owner turned Touch ID on leaves the driver to the Touch ID load,
which owns its options. As that load, the unit waits for the iBoot System
Container's partition link, which the driver opens as it probes without
retrying, inside the service rather than as a device dependency.

The load is read-only: modprobe apple-sep xart_writes=0 provision_keybag=0
boots the enclave, never writes the anti-replay store shared with macOS and
makes no keybag, and Touch ID stays off since its activation needs the
owner's record. Confirmed on a MacBook Air M1 (J313, t8103, macOS 13.5
firmware): the kernel logged the xART writes as disabled, TZ0 accepted and
IMG4 acknowledged, and the microphone delivered live audio at about
-42 dBFS; Superwhisper then transcribed speech. The read-only driver leaves
Linux-only state in /var/lib/aurora-sep-host-state.bin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defect was established.

Summary

Adds a read-only Secure Enclave boot service for M1-family microphones.

  • M1-family Macs boot the Secure Enclave so built-in microphones can work.

No actionable issues were established. Tests were inspected, not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Boot] --> B{Touch ID record exists?}
  B -->|Yes| C[Existing Touch ID load]
  B -->|No| D{M1-family tree enables SEP?}
  D -->|No| E[Skip microphone load]
  D -->|Yes| F[Wait for partition link]
  F --> G[Load SEP with read-only options]
  G --> H[Start greeter]
Loading

Reviews (1) · Last reviewed commit: "Boot the Secure Enclave read-only at boo..." · Reviewed by Greptile

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down, Naeem. The diagnosis matches what we see in the kernel tree, and loading the driver read-only is exactly the right shape for a workaround until omacom/linux-aurora#180 lands. We found no code defect that blocks this.

The one real ask: before this ships to every M1 in 4.5, we'd like one real boot on M1 hardware. Nothing loaded this driver on M1 by default until now. With this PR, every M1 owner starts running its suspend notifier, hwrng and shutdown paths at every boot, and so far it has only been loaded by hand.

Hardware check

  • Reboot with the unit installed: the unit succeeds
  • journalctl -k -b shows IMG4 acknowledged
  • Note whether xART: refused the enclave's write appears
  • Mic works
  • Lid-close suspend and resume: mic works after resume, overnight drain looks normal
  • Clean reboot and shutdown
  • Boot macOS afterwards: Touch ID unlock and FileVault login still work

The driver's read-only guarantee covers what Linux writes. Whether the enclave itself wants to write during a plain boot, and what it does when refused, can only be seen on hardware. A boot with xarm_trace=1 would show it.

Smaller points

  1. When this unit's modprobe is the first load and an apple_sep xart_writes= or provision_keybag= option is already set elsewhere, the load fails with EEXIST, even when the other setting is also 0. If the driver is already loaded, a plain modprobe exits 0 and ignores the options. So on a linux-aurora#180 kernel (udev loads first), or with aurora-sep's own loader (ordered Before=systemd-udevd), this is at most a red unit and the mics still work. The mics stay dead only when nothing else loads the driver:

    • a hand-written or orphaned options apple_sep xart_writes=…/provision_keybag=… conf, which aurora-sep's README tells owners to set
    • apple_sep.xart_writes= on the kernel command line, which kmod passes to modprobe and which the omarchy-mac README describes as an override

    It fails safe, but the owner gets a failed unit and no mic. Could the unit skip when modprobe -c or /proc/cmdline already sets apple_sep options, and leave the load to whoever configured it?

  2. modprobe returns as soon as TZ0 is sent, so a handoff that fails later (for example, no SEP firmware region from m1n1) leaves the unit green and the mic silent. No check needed in this PR, but worth knowing when triaging "mic dead on M1" reports.

  3. Two test gaps, both found by mutation. Everything else we broke failed the test.

    • Dropping omarchy-mac-touchid-status.service from After= (omarchy-mac-sep-load.service:13) still passes.
    • Adding apple,t8140 to the gate (lib/sep-for-microphone:13) still passes. The Neo is the one later Mac whose tree enables the SEP node, so it's the negative case most worth a fixture.
  4. The driver says it is "deliberately not exported as a module alias ... only after the owner has enabled it (or chosen read-only)" (sep.rs, above OF_TABLE). This unit loads it on every M1 with no choice offered. linux-aurora#180 makes the same call in the kernel, so the two agree, but the manual should say how to opt out (systemctl mask omarchy-mac-sep-load.service). Could you also open an issue to remove the unit once linux-aurora#180 ships? Nothing here removes it automatically.

What we checked and agree with

We read the unit and helper against the driver on linux-aurora integration/aurora (396f2d63edc).

  • Read-only holds at the block layer, not just by policy. With xart_writes=0 the driver opens the iBoot System Container O_RDONLY (store_shim.c, sep_store_open_block), the store never arms repair, and Store::write()/delete() return EROFS (xart_store.rs:120-200, :346, :402). provision_keybag=0 skips keybag creation. The driver writes only Linux-side files under /var/lib (host-state, xart-owned, keybag, refkey, catacomb), and the "already booted" marker is an in-memory DT property. This is a really nice design.
  • The options can't be quietly overridden. Rust module params are SetOnce (rust/kernel/module_param.rs:78-83). modprobe puts config options before command-line ones (modprobe -D shows ... xart_writes=1 provision_keybag=1 xart_writes=0 provision_keybag=0), so a conflicting options apple_sep xart_writes=1 makes the second set return EEXIST and load_module refuses to load. It never ends up loaded with writes on.
  • Every Omarchy-era kernel has both params (we checked the tags from aurora-2026.10.09 on), so a snapshot boot onto an older kernel still gets them. Kernels from before the params existed had no xART store code.
  • The gate is exact and fails closed. Only j293, j313, j456/j457 and the four t6000/t6001 MacBook Pros enable &sep. The Mac mini (j274) and the M1 Max Mac Studio (j375c, a t6001) leave it disabled, the M1 Ultra Studio (j375d, t6002) is outside the compatible list, and on every t600x the node sits at /soc/sep@396400000. On M2 and M3 the node is disabled in the tree, and the Neo is enabled but outside the compatible list. Every error path (missing predicate, unreadable tree, no node, missing helper) exits 1 or 203, which systemd treats as a skip.
  • On M1, Touch ID eligibility reports unsupported:m1-family, so touchid-on can't be created there and the Touch ID load and this unit don't overlap. touchid-enable already handles a driver someone else loaded (preloaded=1).
  • The wants link sits in /usr/lib, so an upgrade needs no enable or migration step and an uninstall removes it. It takes effect at the next boot.

What we ran: omarchy-mac/test/all (119 ok), sep-microphone-test.sh alone, .github/scripts/check-scope and check-architecture-gates. All pass, and CI is green including Shellcheck. We mutated the gate, status check, platform check, final exit, read-only options, Touch ID condition, wants link and greeter ordering, and each one failed the test. We haven't run it on hardware.

@jeffsauer

Copy link
Copy Markdown

I applied this on a clean new Omarchy 4.5 install on a M1 Macbook Air and can confirm the PR works and survives warm and cold reboots.

@sagomr

sagomr commented Nov 7, 2026

Copy link
Copy Markdown

Same symptom here on a second MacBook Air M1, on a recent install (2026-11-05). The manual load in this PR fixed it.

System

  • MacBook Air M1 (J313, apple,t8103), macOS 13.5 firmware (asahi,os-fw-version)
  • linux-aurora 7.2.11.aurora14-1, omarchy-mac 0.2.3-2, aurora-audio 4.1.aurora3-3
  • pipewire 1.6.9, wireplumber 0.5.18
  • The microphone works in macOS on the same machine

Observed

  • Raw capture from hw:0,0 (3 channels, 48 kHz) shows about -65 dB for the first 20 ms, then decays to near-zero values and exact zeros on all three channels. Tested without speaking.
  • effect_output.j313-mic also falls to exact silence.
  • apple_sep is not loaded and modinfo apple-sep lists no alias: line.
  • soc/sep@242400000 has compatible = "apple,sep" and status = "okay".
  • omarchy-mac-sep-load.service is not present, as expected on 0.2.3.
  • USB-C EarPods work as an input on the same system, so the failure appears limited to the built-in microphones.

Ruled out

  • Setting options snd_soc_aop mic_check_123=1 and rebooting made no difference.
  • The lid reports open, and there are no driver errors in the kernel log.

Manual load of apple-sep

After sudo modprobe apple-sep xart_writes=0 provision_keybag=0, the near-zero output is gone without a reboot. Raw capture now holds a steady noise floor of about -81 dB on all three channels, and omarchy_asahi_mic reads about -52 to -57 dB (no deliberate speech during the measurement). Superwhisper also transcribed speech correctly.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 7510ab6.

Thanks Naeem, and thanks to the two testers who confirmed it on M1 Airs. The read-only load is the right workaround until omacom/linux-aurora#180 lands, and I found nothing that writes the shared xART store. A few things need to change before merge, though.

Before merge

  1. Conflicts. main is at 0.2.6. Resolve omarchy-mac/version and omarchy-mac/README.md and bump to 0.2.7.
  2. The fprintd gate this repo already asks for. The Touch ID load bullet in omarchy-mac/README.md says fprintd still opens /dev/sep-bio when it probes its readers, so a kernel that loads the driver on every Mac needs fprintd's allowance for the node gated first. This PR is that kind of load on every M1. omarchy-mac-touchid-activate.service is gated on the owner's record, but fprintd isn't. On an M1 with fprintd installed (a USB reader, say), probing the readers opens the node, and an open is activation (lib/touchid-activate:44-46). With xart_writes=0 provision_keybag=0 that shouldn't write anything shared. It still crosses the consent boundary the package draws. Either gate fprintd's allowance on /etc/omarchy-mac/touchid-on, or show that the shipped libfprint never opens sep-bio on these Macs.
  3. Scott's EEXIST point. If apple_sep xart_writes=/provision_keybag= is already set in modprobe.d or on the cmdline and this is the first load, the unit fails and the mic stays dead. Skipping the unit when options are set elsewhere only avoids the red unit, so handle both cases: configured elsewhere and loaded by someone else, versus configured but nothing else loads it. Please add tests for duplicate zero, conflicting and already-loaded.
  4. Docs that become false on M1:
    • omarchy-mac/README.md fingerprint-readers bullet: "Nothing loads the Secure Enclave driver until the owner agrees", and that disable-fingerprint makes the driver stop loading.
    • mac-manual/content/04-security.md: "Turning Touch ID off later … stops the driver loading."
    • Please also document the opt-out, systemctl mask omarchy-mac-sep-load.service.

Behaviour change, accepted explicitly. This boots the enclave shared with macOS on every M1 at every boot without asking the owner. The driver's own OF_TABLE comment reserves that for an owner choice. Default-on with a documented mask is defensible to get the built-in mics working, and I'm fine with it. I'm saying it here so it's an explicit decision and not a side effect of a bug fix.

Before release (not blocking merge to edge): Scott's checklist on a real installed boot. Lid suspend and resume with the mic, overnight drain, clean shutdown, and macOS Touch ID and FileVault afterwards are still unreported. Please include journalctl -k -b for IMG4 acknowledged and any xART: refused the enclave's write. Please also send systemd-analyze blame and critical-chain display-manager.service, since the unit sits in front of the greeter with a 20 s wait plus the SEP handshake.

Nice to have

  • One t6000/t6001 confirmation that the mic is dead without the enclave and works with it. Only t8103 has been tested so far.
  • Scott's two test gaps: drop omarchy-mac-touchid-status.service from After=, and add apple,t8140 as a negative fixture.
  • An issue to remove the unit once linux-aurora#180 ships.

malik-na and others added 5 commits November 12, 2026 04:11
The driver's parameters can be set once, so passing xart_writes or provision_keybag after the same option in modprobe.d or on the kernel command line fails the load with EEXIST, and the microphone stays silent when nothing else loads the driver. lib/sep-load counts what modprobe -c and /proc/cmdline set, passes only the missing write options as 0, uses options already at 0, and leaves a loaded driver or any write option other than 0 to whoever set it. An option set twice fails the unit with a message. Writes are never enabled.
…ps the MacBook Neo

Dropping omarchy-mac-touchid-status.service from After= and adding apple,t8140 to the gate both passed the suite; each now fails it.
Every helper under lib stops off Apple Silicon on its own; the platform test caught sep-load without it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks both. I went through the review points that don't need the M1. Pushed to this branch as a merge of main (no rebase), so the history stays as reviewed.

Marcelo's list:

  1. Merged main (0.2.6) in, resolved version and README, bumped omarchy-mac to 0.2.7.
  2. fprintd gate: I read libfprint's Apple driver patch (omarchy-pkgs#806). Its probe opens /dev/sep-bio read-write as soon as udev lists the misc node, so I can't show it never opens it on these Macs. I haven't gated it here: the allowance lives in libfprint-git's drop-in, and a drop-in in this package can't take it away conditionally without also breaking fprintd for USB readers. Left open, unless you'd rather I do it differently. Whether the node exists with the read-only load needs the M1.
  3. EEXIST: the unit now runs lib/sep-load instead of a bare modprobe. It looks at modprobe -c and /proc/cmdline. Driver already loaded: left alone. Option already at 0 elsewhere: used as is, so the mic still works when nothing else loads the driver (and it is a no-op if something else does). Only one of the two set: it passes the other as 0. Anything other than 0 set elsewhere: skipped, nothing loaded, so writes never get enabled. An option set twice, even to 0: the unit fails with a message saying so, since that load can't succeed. Fixture tests cover nothing set, set at 0 in modprobe.d or on the cmdline, partly set, duplicate zero, conflicting, and already loaded.
  4. Docs: the fingerprint-readers bullet, the Touch ID off sentence in the security page, and the hardware page now describe the M1 read-only load. The opt-out systemctl mask omarchy-mac-sep-load.service is documented in the README and the manual.

Scott's two test gaps: a test now fails if omarchy-mac-touchid-status.service leaves After=, and there's an apple,t8140 (MacBook Neo) negative fixture for the helper. I checked both by mutating them.

Not done yet: the real boot checklist, the journalctl -k -b and systemd-analyze output, and the t6000/t6001 check all wait for the M1. I'll post them when I have them. Removing the unit once linux-aurora#180 ships is a follow-up for after that lands.

I ran each test script on its own: all pass except setup-test and desktop-setup-test, which can't write to $HOME where I ran them (main fails the same way there), so CI is the check for those two. check-scope and check-architecture-gates pass.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malik-na, thanks, this round at ed7c3ce closes most of my list. The merge and 0.2.7 bump are in. lib/sep-load handles options set elsewhere without ever passing anything but 0. The docs no longer say nothing loads the driver, the mask is documented, and Scott's two test gaps now fail the suite.

Still needed before merge:

  1. fprintd can still open /dev/sep-bio on these Macs. You've confirmed libfprint's probe opens it read-write, and I agree the gate can't be done from this package, since the allowance is in libfprint-git's drop-in. Whether the read-only load creates the node still needs the M1, as you say, so this is conditional on the node existing. It still needs one of two things: an omacom/omarchy-pkgs change that gates the allowance on /etc/omarchy-mac/touchid-on and lands first, or an explicit decision from Marcelo to accept it until then, with README.md:29 saying so. Only M1 owners who installed fprintd are exposed. Please don't order fprintd after this unit in the meantime, since that would only make the access more reliable.
  2. The kernel command line is counted twice (lib/sep-load:25-29). kmod already parses apple_sep.* words from /proc/cmdline into the options modprobe -c prints. Reading /proc/cmdline as well counts a single apple_sep.provision_keybag=0 twice, so the unit fails at :44-46 and the mic stays silent. The test's modprobe -c stub prints only the config, so it can't show this. Please drop the /proc/cmdline loop and keep the duplicate check for real duplicates. Please also have the stub print command-line options as kmod does, with two fixtures: an option only on the command line (loads) and the same option in both places (fails).

Smaller things:

  • A quoted zero skips the load (sep-load:37). The kernel strips the quotes from xart_writes="0", so it's a valid zero. The helper treats it as writes enabled, though, and the mic stays silent behind a green unit. It fails safe. Please strip the quotes before comparing, add a fixture, and log that the built-in microphones stay silent whenever it does skip.
  • Hyphenated names are missed (sep-load:30). The kernel treats xart-writes and xart_writes as the same parameter, but the filter only knows the underscore form. With options apple_sep xart-writes=0, the helper also appends xart_writes=0, the duplicate refuses the load, and the mic stays silent. Please normalise - to _ in parameter names before filtering and counting, with fixtures.
  • README.md:29 still says the module "loads only on the owner's record". Suggest adding "or, on M1-family Macs, through the read-only microphone load".

Nits, fine as follow-ups: the unit's header is eight lines and sep-load's is four, where AGENTS.md:34 asks for three. Please write omacom/linux-aurora#180 in omarchy-mac-sep-load.service:4 and README.md:30, since a bare #180 reads as this repo's.

CI: every check passes, including the package suite. It stubs modprobe, though, so it doesn't cover point 2, and the systemd-analyze blocks only run where the runner has it.

For release, not the merge: this is boot-critical, so it still needs a real installed boot on an M1 (CONTRIBUTING). That means Scott's checklist and the journalctl -k -b, systemd-analyze blame and critical-chain display-manager.service output. A t6000 or t6001 confirmation would still be good to have.

Reviewed at ed7c3ce1ba41.

— Marcelo's agent

Comment thread omarchy-mac/lib/sep-load Resolved
Comment thread omarchy-mac/lib/sep-load Resolved
Comment thread omarchy-mac/lib/sep-load Resolved
malik-na and others added 4 commits November 12, 2026 06:01
kmod folds the apple_sep.* words of /proc/cmdline into the options that
modprobe -c prints (libkmod-config.c, kmod_config_parse_kcmdline), so reading
/proc/cmdline as well counted one setting twice and failed the load with a
false duplicate. The modprobe stub in the test now prints command-line options
the way kmod does: after the files, one options line per word.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The kernel reads xart-writes and xart_writes as one parameter. With
options apple_sep xart-writes=0 the filter missed the setting, sep-load added
xart_writes=0 and the second setting refused the load with EEXIST. Names are
normalised before filtering and counting.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tay silent

The kernel strips the quotes of xart_writes="0", so it is a valid zero, but the
helper read it as writes enabled and skipped the load. Quotes are stripped
before comparing. Whenever the helper leaves the load to someone else or fails
on a duplicate, it now logs that the built-in microphones stay silent.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
README line 29 now says the module also loads through the read-only
microphone load on M1-family Macs. The unit and sep-load headers are three
lines, as AGENTS.md asks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks for the second pass, Marcelo. I pushed a round that covers everything except the fprintd gate.

  • Command line counted twice: you were right. kmod turns each apple_sep.* word of /proc/cmdline into an options line in what modprobe -c prints (kmod_config_parse_kcmdline in libkmod-config.c, v34.2), so I removed the /proc/cmdline loop from lib/sep-load. The duplicate check now only sees what modprobe -c lists. If the same option is in a modprobe.d file and on the command line, modprobe -c lists it twice and the real modprobe would pass it twice, so that still fails with the message, as it should. The test's modprobe stub now prints the command-line words the way kmod does, with fixtures for an option only on the command line (loads) and the same option in both places (fails).
  • Hyphenated names: xart-writes and xart_writes are normalised before filtering and counting. Fixtures for modprobe.d, the command line, a hyphen/underscore duplicate, and a hyphenated =1.
  • Quoted zero: quotes are stripped from the value before comparing, so xart_writes="0" is a zero (fixtures for modprobe.d and the command line, plus a quoted one that still skips). Whenever the helper skips because of options set elsewhere, or fails on a duplicate, it now logs that the built-in microphones stay silent.
  • Docs and headers: README now says the module loads only on the owner's record "or, on M1-family Macs, through the read-only microphone load". soc: apple: sep: boot the enclave without the xART store and autoload it (fixes the M1 microphones, #141) linux-aurora#180 is written in full in the README and the unit header, and the unit and sep-load headers are three lines each. The version stays at 0.2.7.

I ran the omarchy-mac suite and the scope and architecture-gate checks, and broke each new fixture's code to see its test fail. In my sandbox setup-test and desktop-setup-test can't run (read-only home, no sockets), and they fail the same way on main, so I'm relying on CI for those two. modprobe -c here is a stub, so I read the kmod source for the cmdline behaviour instead of running it with a fake cmdline.

Still open:

  • The fprintd gate. As you said it needs an omacom/omarchy-pkgs change that gates the allowance on /etc/omarchy-mac/touchid-on, or a decision from you to accept it until then (with a note in README). I haven't touched it and I haven't ordered fprintd after this unit.
  • The real boot on an M1: Scott's checklist plus journalctl -k -b, systemd-analyze blame and critical-chain display-manager.service. I'll post those once I have them.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malik-na re-reviewed at 77a58f6: all the code points from my last round are fixed.

  • lib/sep-load now reads only modprobe -c (sep-load:17-25), so a command-line option is counted once. The stub prints command-line words the way kmod does, with fixtures for an option only on the command line and one in both places (sep-microphone-test.sh:121-124).
  • Quotes are stripped and hyphens normalised before counting (sep-load:18, :22), with fixtures for each.
  • A skipped or failed load now says the built-in microphones stay silent (:33, :40), and the test checks it.
  • README.md:29 names the read-only microphone load, omacom/linux-aurora#180 is written in full, and both headers are three lines.

The helper still only ever passes 0 (sep-load:43), and it leaves any other write setting to whoever set it. I found no code blockers.

Still open before merge, and not a code issue:

  • fprintd can open /dev/sep-bio on M1 Macs with fprintd installed. The activation unit waits for the owner's record (omarchy-mac-touchid-activate.service:8), but the fprintd drop-in only orders fprintd (fprintd.service.d/50-omarchy-mac-touchid.conf:5-6). This needs a decision from Marcelo. One option is an omacom/omarchy-pkgs change that gates libfprint-git's allowance on /etc/omarchy-mac/touchid-on and lands first. The other is accepting the exposure until then, noted in README.md:29. Thanks for not ordering fprintd after this unit in the meantime.

Nit, fine as a follow-up: AGENTS.md:33 prefers a full if/else to an exit in one branch (sep-load:10-13, :32-35, :39-41).

CI: every check passes, including the package suite, which runs sep-microphone-test.sh. modprobe is stubbed there, so kmod's real modprobe -c output is only covered by a hardware boot.

For release, not the merge: this is boot-critical, so it still needs cold-boot evidence from an installed M1 (CONTRIBUTING.md:54). That means Scott's checklist plus the journalctl -k -b, systemd-analyze blame and critical-chain display-manager.service output. The earlier tester reports came before sep-load. A t6000 or t6001 confirmation would still be good to have.

Reviewed at 77a58f66cdbe.

— Marcelo's agent

…anches

The helper keeps the same behaviour: a driver already loaded is left alone,
a write option enabled elsewhere leaves the load to its owner, an option
set twice fails with the EEXIST message, and only the options still unset
are passed as 0, in option order as before. Each outcome is now a branch of
one if/else chain at the end, as AGENTS.md prefers, rather than an exit
inside the loops. Nothing passes anything but 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malik-na re-reviewed at ba0736d. The if/else rewrite of lib/sep-load keeps every outcome the same, and it fixes the nit from my last round.

  • A loaded driver is still left alone (sep-load:10-11).
  • A non-zero setting still leaves the load to its owner, with exit 0 (:33-35, :50-51). As before, it wins over a duplicate of the same option.
  • A duplicate still fails with the EEXIST message and exit 1 (:42-44, :52-54), and xart_writes is still settled before provision_keybag.
  • Only unset options are passed, and only as 0 (:45-46, :56).

The existing fixtures cover each of those branches (sep-microphone-test.sh:115-154). I found no code blockers.

Still open before merge, and not a code issue:

  • fprintd can open /dev/sep-bio on M1 Macs with fprintd installed. Nothing has changed here since my last round. The activation unit waits for the owner's record (omarchy-mac-touchid-activate.service:8), but the fprintd drop-in only orders fprintd (fprintd.service.d/50-omarchy-mac-touchid.conf:5-6), and an open is activation (lib/touchid-activate:44-46). This needs a decision from Marcelo. One option is an omacom/omarchy-pkgs change that gates libfprint-git's allowance on /etc/omarchy-mac/touchid-on and lands first. The other is accepting the exposure until then, noted in README.md:29.

CI: every check listed passes, including the package suite, which runs sep-microphone-test.sh. The list doesn't name a commit, though, so it's worth confirming the runs are at ba0736d. modprobe is stubbed in the suite, so kmod's real modprobe -c output is only covered by a hardware boot.

For release, not the merge: this is boot-critical, so it still needs cold-boot evidence from an installed M1 (CONTRIBUTING.md:54). That means Scott's checklist plus the journalctl -k -b, systemd-analyze blame and critical-chain display-manager.service output. The tester reports from 2026-11-07 came before sep-load. A t6000 or t6001 confirmation would still be good to have.

Reviewed at ba0736d41a73.

— Marcelo's agent

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at ba0736d.

Thanks Naeem, this round closes nearly everything. The conflicts and the 0.2.7 bump are in, lib/sep-load handles the ordinary EEXIST cases, the docs and the mask opt-out are in, and Scott's two test gaps now fail the suite. CI is green at this head. Two things are left before merge.

1. sep-load can still load with writes on (lib/sep-load:15-23, :56). kmod passes modprobe.d options before the ones on the modprobe command line, and the kernel stops parsing at --. It warns but still loads the module (kernel/params.c:183, kernel/module/main.c:3585). So with options apple_sep --, the appended xart_writes=0 provision_keybag=0 are ignored, and a pre-linux-aurora#180 kernel loads with its write defaults. Quoted whitespace gets around it too. With options apple_sep foo="a provision_keybag=0", the helper's whitespace split sees provision_keybag=0 and doesn't append it, but the kernel sees one unknown foo parameter, so the keybag default applies. Both configs are contrived, but "never enables a write" is the guarantee this unit rests on. Please parse fail-closed: skip the load, with the microphone message, on any apple_sep option token that isn't a plain name=value (--, embedded whitespace or a quote anywhere but around the value). Please also skip when modprobe -c itself fails, rather than appending both zeros blind. Add fixtures for -- and for the quoted-whitespace case.

2. Please gate fprintd away from /dev/sep-bio until the owner agrees. libfprint-git's drop-in allows /dev/sep-bio rw unconditionally (omacom/omarchy-pkgs pkgbuilds/libfprint-git/fprintd-aurora-touchid.conf:18), and its Apple driver opens the node read-write when fprintd probes for readers (aurora-apple-sep.patch:383). An open is activation (lib/touchid-activate:44-46), so on an M1 with fprintd installed, the enclave gets a Touch ID activation attempt without the owner's record. That includes every M1 owner who set up a USB reader, which entrypoints/enable-fingerprint:50-64 deliberately allows. The read-only options still keep shared state unwritten, but this is the consent boundary the package draws, on a chip where Touch ID isn't qualified. It also makes "Touch ID stays off, since its activation needs the owner's record" (README.md:30) untrue.

The microphone doesn't need the node: it works once the driver has booted the enclave, with nothing opening sep-bio. So the gate costs the fix nothing, and it can live in this package:

  • A systemd generator in omarchy-mac writes a fprintd.service.d drop-in with InaccessiblePaths=-/dev/sep-bio whenever /etc/omarchy-mac/touchid-on is absent. fprintd's probe then can't open the node, and USB readers are unaffected.
  • touchid-enable runs systemctl daemon-reload before the fprintd restart it already does, and disable-fingerprint reloads and restarts fprintd too, so the drop-in follows the record without a reboot.
  • Owners who already agreed have the record, so they never get the drop-in. No migration is needed, and M2, M3 and the Neo behave as today.
  • Tests: the drop-in is generated without the record and not with it, and enable and disable reload.

Please confirm on the M1 that fprintd then lists only the USB reader. A different mechanism is fine if it gives the same result. If the read-only driver turns out not to register /dev/sep-bio at all, an ls /dev/sep-bio from the boot below is enough to drop this point. linux-aurora#180 needs the same gate, and the cleaner long-term fix is for the kernel not to register the node in read-only mode.

Nice to have: modprobe -b would also honour a blacklist apple_sep an owner set to keep the enclave off. The mask stays the documented opt-out.

Before release, unchanged: cold-boot evidence from an installed M1 (CONTRIBUTING.md:54), meaning Scott's checklist plus journalctl -k -b, systemd-analyze blame, critical-chain display-manager.service and now ls -l /dev/sep-bio. The earlier tester reports came before sep-load. A t6000 or t6001 confirmation would still be good to have.

@maralcbr

Copy link
Copy Markdown
Member

Thanks Naeem.

  1. Agreed: on Omarchy, only omarchy-mac-touchid.conf sets the options. Please fix the README line saying the name "sorts after apple-sep.conf, so the owner's agreement wins"; with set-once parameters both files are passed and the load fails with EEXIST. Once soc: apple: sep: boot the enclave without the xART store and autoload it (fixes the M1 microphones, #141) linux-aurora#180 autoloads the driver, that also silences the M1 mics at boot, so have touchid-enable refuse, naming the file, when an apple-sep.conf exists.
  2. Push the generator gate into this PR and keep it permanently as fprintd's consent check, the same record the activation unit uses. Separately, a small linux-aurora follow-up (not in soc: apple: sep: boot the enclave without the xART store and autoload it (fixes the M1 microphones, #141) linux-aurora#180, so its review doesn't restart) should stop publishing sep-bio when xart_writes=0. A read-only driver reports matching as blocked anyway.
  3. Order: this PR first, then soc: apple: sep: boot the enclave without the xART store and autoload it (fixes the M1 microphones, #141) linux-aurora#180, then the kernel pin, then removing sep-load. The pin doesn't wait for the aurora-touchid 20261003-3 upload, since Omarchy doesn't ship aurora-touchid. It does wait for this PR, gate included, to be in the repo, plus an M1 cold boot showing live mics and /dev/sep-bio closed to fprintd.

Still needed before release: the fail-closed parse in sep-load (skip on --, quoted whitespace, or a failed modprobe -c), the M1 cold-boot evidence, and a t6000/t6001 confirmation.

The driver's parameters can be set only once, so an
/etc/modprobe.d/apple-sep.conf next to omarchy-mac-touchid.conf passes
them twice and every load fails with EEXIST; with omacom/linux-aurora#180
loading the driver at boot, that also silences M1-family microphones.
touchid-enable now names the file, says to remove it, and changes
nothing. The README no longer claims the options file wins by sorting
after apple-sep.conf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malik-na re-reviewed at 927febb, and thanks @scottjones for the commit. The README no longer claims omarchy-mac-touchid.conf wins by sorting. touchid-enable now refuses beside an apple-sep.conf, and it does so before it takes the lock or carves, records or loads anything (lib/touchid-enable:84-86). fail() has nothing to undo at that point, and the check also catches a dangling symlink. The test checks all of that, and checks that the owner's file and an earlier record are left alone (touchid-consent-test.sh:514-526).

One thing before merge:

  • The fprintd gate isn't in yet. Per Marcelo's comment of 2026-11-14, the generator gate belongs in this PR as fprintd's permanent consent check. There's no generator or InaccessiblePaths= under omarchy-mac/ yet, and fprintd.service.d/50-omarchy-mac-touchid.conf only orders fprintd. So README.md:30 ("Touch ID stays off, since its activation needs the owner's record") still doesn't hold on an M1 with fprintd installed. Please add:
    • the generator that blocks /dev/sep-bio for fprintd while /etc/omarchy-mac/touchid-on is absent
    • a daemon-reload before touchid-enable's fprintd restart (:168)
    • a reload and an fprintd restart in disable-fingerprint
    • tests for each

Should fix:

  • enable-fingerprint can still write the options beside an apple-sep.conf. For an owner who agreed before the options file existed, entrypoints/enable-fingerprint:14-40 writes omarchy-mac-touchid.conf itself and exits at :48 without running touchid-enable. The new refusal doesn't apply there, so that owner can still end up with the double setting and EEXIST. The new test at touchid-consent-test.sh:524-526 only covers touchid-enable. Could you run the same check under the lock before :33, with the same message, and add an ask test with the record, an apple-sep.conf and no options file?

Smaller things:

  • README.md:29 needs qualifying. It says that with apple_sep.xart_writes=0 on the command line "nothing is written". Nothing shared is, but touchid-enable doesn't check the command line. With the driver already loaded, which is the normal case once omacom/linux-aurora#180 ships, modprobe exits 0 and the agreement and options stay (:171-175). Every later boot's load then fails with EEXIST, so Touch ID never comes up. Please either reword it, or widen the refusal to any apple_sep write setting that modprobe -c already lists while our options file doesn't exist yet. If you widen it, please don't reuse the parsing in lib/sep-load:15-23 as it is. Parse fail-closed instead: refuse on a failed modprobe -c or on any token that isn't a plain name=value.
  • The PR body needs a refresh:
    • add the new refusal to the behaviour notes
    • update the version (0.2.7, not 0.2.5)
    • drop "so nothing opens it" for /dev/sep-bio until the gate is in

CI: every listed check passes, including the package suite. The list doesn't name a commit, though, so it's worth confirming the runs are at 927febb. modprobe is stubbed in the suites, so kmod's real behaviour is only covered by a hardware boot.

For release, not the merge (per Marcelo's comment of 2026-11-14):

  • The fail-closed parse in sep-load is still open. :15-23 drops --, splits quoted values on whitespace, and treats a failed modprobe -c as nothing set (:23). So on a kernel before omacom/linux-aurora#180, the load at :56 can go ahead without the read-only options taking effect. Please skip the load in each of those cases, with the microphone message, and add fixtures for --, quoted whitespace and a failing modprobe -c.
  • This is boot-critical, so it needs cold-boot evidence from an installed M1 (CONTRIBUTING.md:54): Scott's checklist plus journalctl -k -b, systemd-analyze blame, critical-chain display-manager.service and ls -l /dev/sep-bio, showing fprintd doesn't open it. A t6000 or t6001 confirmation too.
  • Order, as Marcelo set it: this PR, then omacom/linux-aurora#180, then the kernel pin, then removing sep-load.

Also:

  • omarchy-mac/entrypoints/enable-fingerprint:33: This branch writes the options for an owner who already agreed without the new apple-sep.conf check from touchid-enable:84, so the EEXIST case can still happen here. Could it run the same check under this lock first?

Reviewed at 927febbb9df8.

— Marcelo's agent

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.

5 participants