Skip to content

apple: follow Aura's enforce policy in the default build - #78

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
fix/aura-enforce-policy
Nov 26, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
fix/aura-enforce-policy

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: The default Apple build follows Aura's enforce policy. When /chosen/aurora,boot-security shows an enforcing stage, U-Boot:

  • ignores uboot.env;
  • gives no console;
  • boots only EFI/BOOT/BOOTAA64.EFI from the internal ESP under UEFI Secure Boot, refusing rather than auditing, and resets otherwise.

The keys come from a seed built into U-Boot. apple_m1_defconfig ships it empty, in a fixed 16 KiB region that aurora-secboot fills with the owner's keys before it signs Stage 2. Before this, only an apple_secboot.config build checked anything, so with the default U-Boot an enforcing Aura's chain ended at U-Boot. Without an enforcing stage the boot is unchanged.

Tested: hardware row on the M3 Pro (J516s, T6030) with U-Boot built from 6d292702, using an enforcing Stage 2 and test keys: (a) a signed UKI boots, recorded verified; (b) an unsigned BOOTAA64.EFI is refused; (c) a uboot.env is ignored under enforce, and runs without it; (e) a seed without keys is refused; (f) a non-enforcing boot is unchanged (#78 (comment)). apple_m1, apple_j873 and apple_m1 + apple_secboot.config build with WERROR; tools/aurora_uefi_seed.py checks the seed region, and CI runs it on apple_m1.

Risk: two-way · every Mac booting this U-Boot. Without an enforcing stage the seed has no PK: Secure Boot stays off, and uboot.env and bootflow work as before. SecureBoot=0 and SetupMode=1 are now reported, where before Secure Boot support was absent.

Not yet:

  • (d), a key press during the boot delay, is covered by the code and the environment values only (bootdelay=-2, Ctrl-C off, empty preboot).
  • The distribution U-Boot pins (250385f8) move to this branch in separate PRs after it merges, each with its own rows.
Details
  • Enforcing means the record's own policy is enforce, or any measurement@N has policy = "enforce", or state is verified.
  • Environment:
    • under enforce, env_get_location() gives only ENV_IS_NOWHERE (the built-in environment, nothing saved);
    • otherwise it gives the build's locations, and a FAT build doesn't fall back to nowhere, so saveenv still creates uboot.env;
    • an apple_secboot.config build (nowhere only) keeps its nowhere location.
  • Boot: bootcmd is run aurora_secure_boot; reset, with bootdelay=-2, an empty preboot and disable_ctrlc(1).
    • aurora_secure_boot loads BOOTAA64.EFI and bootefis it with the control FDT.
    • A failure or a return prints AURORA_UBOOT_SECURE_FAIL and resets.
    • With no PK in the seed (apple_seed_has_pk(), a bounds-checked walk of the built-in efi_var_file), it only reports and resets.
  • Audit vs enforce: efi_init_secure_state() chooses CONFIG_EFI_AURORA_SECBOOT_AUDIT's audit state only when the new weak efi_aurora_enforce_policy() is false. The Apple board returns whether the record shows an enforcing stage, so the same image audits under an audit Aura and refuses under an enforcing one.
  • Keys: ubootefi.var never restores PK, KEK, db, dbx, dbt, dbr, AuditMode or DeployedMode (efi_var_restore(..., false)); with PRESEED they are also write-protected.
  • Measurement: unchanged. efi_aurora_measure.c records each image with its verdict.
  • Seed region: board/apple/mac/uefi-seed.var (.var, because *.bin is ignored) is an empty efi_var_file, zeros, and the 32-byte marker AURORA-UEFI-SEED + size + version 1 at the end of 16384 bytes. tools/apple_secboot_seed.py now writes that same region and refuses variables that don't fit.
  • Makefile: the seed dependency used $(srctree)/ even for an absolute path, so the absolute seed path apple_secboot.config asks for failed with "No rule to make target". An absolute path is now used as-is, and -I$(srctree) lets a relative one build with O=.
  • apple: follow Aura's enforce policy: fixed boot path, verified EFI only #77: this replaces apple: follow Aura's enforce policy: fixed boot path, verified EFI only #77, which targeted main. The shipped U-Boot comes from aurora-wip, and main's U-Boot resets before Linux on T6030.
Evidence
$ make O=b apple_m1_defconfig && scripts/config --file b/.config --enable WERROR && make O=b olddefconfig && make O=b
$ python3 tools/aurora_uefi_seed.py b/u-boot-nodtb.bin
b/u-boot-nodtb.bin: seed region at 0x8f0c0, 16384 bytes, 0 bytes of variables
$ make O=s apple_m1_defconfig apple_secboot.config && scripts/config --file s/.config --set-str EFI_VAR_SEED_FILE /abs/seed.var ... && make O=s
s/u-boot-nodtb.bin: seed region at 0x8d230, 16384 bytes, 2792 bytes of variables

apple_j873 also builds with WERROR. The local builds turn off TOOLS_KWBIMAGE/TOOLS_LIBCRYPTO, because this host's OpenSSL 4.1 has no ENGINE API; that's unrelated and also fails without this change. CI uses Ubuntu's OpenSSL.

aura records what each boot stage checked in /chosen/aurora,boot-security
of the devicetree it passes to U-Boot. When a stage enforced, aura's
signature covers U-Boot, but the default build then still read the
saved uboot.env from the ESP, kept the boot delay and the console, and
booted through bootflow, booti or scripts with nothing checked. Only a
U-Boot built with apple_secboot.config boots signed images, and its
seed had to be built in at compile time.

When the record shows an enforcing stage (policy "enforce" on the node
or on a measurement, or state "verified"), the default build now:

- uses the built-in environment: env_get_location() offers only
  ENV_IS_NOWHERE, so uboot.env is neither read nor written. Without an
  enforcing stage a FAT build behaves as before, and the nowhere
  location is not added as its fallback;
- boots at once with no key check (bootdelay -2), ignores Ctrl-C and
  runs no preboot;
- boots only EFI/BOOT/BOOTAA64.EFI from the internal ESP through
  bootefi under UEFI Secure Boot, and resets on failure or return;
- refuses images that fail authentication even in an audit build:
  efi_init_secure_state() asks the new efi_aurora_enforce_policy() hook
  (weak, false) before it chooses CONFIG_EFI_AURORA_SECBOOT_AUDIT's
  audit state, and the Apple board answers from the record;
- refuses to boot when its seed has no PK.

apple_m1_defconfig enables EFI_SECURE_BOOT (with FIT and FIT_SIGNATURE,
which it depends on), the audit mode, ENV_IS_NOWHERE and a preseed of
board/apple/mac/uefi-seed.var: an empty variable seed in a fixed 16 KiB
region ending in the marker AURORA-UEFI-SEED, its size and version,
which aurora-secboot fills with the owner's keys before it signs
Stage 2. Without keys Secure Boot stays off and the boot is unchanged;
with keys and no enforcing stage it audits. EFI_AURORA_MEASURE records
each image, as before.

tools/apple_secboot_seed.py now writes the same region, so a seed built
into an apple_secboot.config build can be refilled and checked the same
way; tools/aurora_uefi_seed.py checks an image, and CI runs it on the
apple_m1 build.

lib/efi_loader/Makefile: the seed's dependency prefixed $(srctree) even
to an absolute path, so the absolute seed path apple_secboot.config asks
for could not build; a relative path now also builds with O=.

doc/board/apple/m1.rst describes the policy.

Signed-off-by: DjDeveloperr <[email protected]>
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 6d292702: not ready yet

Check Detail
CI at head ok 2 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 6d292702
Conflicts ok none
PR text ok Risk: two-way · every Mac booting this U-Boot. Without an enforcing stage the seed has no PK: Secure Boot stays off, and uboot.env and bootflow work as before. SecureBoot=0 and SetupMode=1 are now reported, where before Secure Boot support was absent.

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware row: M3 Pro (J516s, T6030), U-Boot built from this head (6d292702). Hold 11:30–11:45 UTC. The stock baseline was restored and verified afterwards.

Setup:

  • Each Stage 2 was chainloaded over Stage 1's proxy, so the ESP's Stage 2 was never written.
  • K1 / K2: aura 683a128b (this Mac's Stage 2 build) with SECBOOT=enforce and the published test key, payloads signed. U-Boot's seed held test PK/KEK/db (K1), or nothing (K2).
  • K3: the stock aura with this U-Boot, not enforcing.
  • U1: a UKI of the stock 27.2 kernel, initrd and command line (plus sec194.uki=1), signed with the test db key.
  • Each image carried a /chosen marker, so the booted Linux shows which chain reached it.
case setup result
(f) not enforcing K3, stock BOOTAA64.EFI (GRUB) pass: GRUB → stock Linux in 19 s, record policy off, U-Boot measured GRUB and the kernel
(b) unsigned EFI K1, stock BOOTAA64.EFI (GRUB) pass: refused, reset after 22 s, stock fallback boot
(a) signed UKI K1, U1 as BOOTAA64.EFI pass: Linux in 27 s on U1's command line; record u-boot enforce efi-image verified with U1's SHA-256; "Kernel is locked down from UEFI Secure Boot"
(c) saved env K1, U1, plus a uboot.env whose bootcmd sets a /chosen marker pass: env ignored, no marker, U1 booted verified
(c) control K3, the same uboot.env the env ran: the boot didn't complete and aura's boot watchdog reset the Mac. The env takes effect without enforce
(e) no keys K2 pass: refused, reset after 24 s
(d) key press — code and env values only (bootdelay=-2, Ctrl-C off, empty preboot); no host input reaches U-Boot on this rig

Notes:

  • U1's inner kernel is unsigned. systemd-stub started it under U-Boot's Secure Boot, so aurora-secboot doesn't need to sign it.
  • The record state was partial, because Stage 1 didn't check the chainloaded Stage 2. With an enforcing Stage 1 it would be verified.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 26, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Verdict at 6d2927020600: ready (code). CI had one check pending when I looked. Row (d) is code-only, as the description says, and the distribution pins follow in their own PRs.

Blockers: none

Checked

  • Every non-EFI boot path is closed under enforce.
    • env_get_location() (arch/arm/mach-apple/board.c:1552) gives only ENVL_NOWHERE, so uboot.env on the ESP is never loaded or saved. That shuts the env-import route to bootcmd, preboot or scripts.
    • apple_enforced_late_init() (1616, called at 1878) sets bootcmd to run aurora_secure_boot; reset, overriding the default bootflow scan -b. It also empties preboot (overriding usb start), sets bootdelay=-2, so autoboot doesn't look for a key, and calls disable_ctrlc(1).
    • aurora_secure_boot only loads EFI/BOOT/BOOTAA64.EFI from ${fw_dev_part} and bootefis it with the control FDT, then resets on failure or return. All its inputs come from the built-in environment and the board, none from the ESP. So bootflow, boot scripts, USB, booti and the EFI boot manager are never reached, and there's no prompt to run them from.
    • In the built .config, EFI_CAPSULE_ON_DISK is off. ubootefi.var is still read, but efi_var_restore(…, false) never restores PK, KEK, db, dbx or the mode variables. A U-Boot without a PK in its seed (apple_seed_has_pk(), a bounds-checked walk), or without ENV_IS_NOWHERE, gets aurora_secure_nokeys and resets.
  • Refuse, not audit. efi_transfer_secure_state() takes the audit branch only when efi_aurora_enforce_policy() is false. Under enforce, user mode refuses images that fail authentication, and SecureBoot=1 makes the UKI stub ignore a loader command line.
  • Nothing on the ESP can spoof the enforce check.
    • apple_boot_enforced() (1516) reads only /chosen/aurora,boot-security in the control FDT that aura hands over. That FDT comes from the signed Stage 2, and with aura#533 an enforcing chain refuses ESP boot= DTBs. aura opens the tree into its full buffer before secboot_export_fdt(), so there's room for the record.
    • Anything that could add a line can only add enforce, which fails closed. A missing record reads as non-enforcing by design, which is why the chain depends on aura always writing it.
  • The non-enforcing path is unchanged. Without an enforcing record, env_get_location() returns the build's own locations, minus the new NOWHERE fallback. So uboot.env loads and saves as before, and a missing one still falls back to the default environment. The seed has no PK, so Secure Boot stays in setup mode and checks nothing. bootcmd and preboot keep their defaults.
  • No runtime switches and no board gates. The policy comes from the hand-over DT, and the 16 KiB region size is a fixed format shared with aurora-platform#47.
Evidence
  • make apple_m1_defconfig, WERROR on (TOOLS_KWBIMAGE/TOOLS_LIBCRYPTO off: this host's OpenSSL has no ENGINE API), make -j4 at 6d2927020600: builds.
  • python3 tools/aurora_uefi_seed.py u-boot-nodtb.bin: seed region at 0x8f0c0, 16384 bytes, 0 bytes of variables.
  • Built .config: EFI_SECURE_BOOT, EFI_AURORA_SECBOOT_AUDIT, EFI_VARIABLES_PRESEED, EFI_VARIABLE_FILE_STORE, ENV_IS_NOWHERE and ENV_IS_IN_FAT are on; EFI_CAPSULE_ON_DISK is off.

@RyanTheTide

Copy link
Copy Markdown
Contributor

6d29270 J413 (M2 Air, T8112, one-shot aura-try, default apple_m1_defconfig) PASS: non-enforcing boot (aura 1.0.0b17 / U-Boot 2026.07-g6d2927020600 -> GRUB -> stock 7.3.0-aurora-fleet89) unchanged with no prompts/delays/resets (9.55 s vs 10.81 s stock); /proc/device-tree/chosen/aurora,boot-security reports policy=off, uefi-secure-boot=off, measurement@3 & measurement@4 u-boot off efi-image measured (identical hashes to stock); 0 kernel errors, Enforcing, 0 failed, 0 AVC; original boot.bin (2f811d68) untouched and stock boot restored.

@DjDeveloperr
DjDeveloperr merged commit 84382f6 into aurora-wip Nov 26, 2026
4 checks passed
@RyanTheTide
RyanTheTide deleted the fix/aura-enforce-policy branch November 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants