Repository navigation
apple: follow Aura's enforce policy: fixed boot path, verified EFI only - #77
Closed
DjDeveloperr wants to merge 1 commit into
Closed
DjDeveloperr wants to merge 1 commit into
DjDeveloperr wants to merge 1 commit into
Conversation
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 nothing U-Boot then reads from the ESP: the saved uboot.env could replace the boot commands, the console could be reached during the boot delay, and the T8140 path fell back to booti and bootflow, none of which checks the image it starts. When the record shows an enforcing stage (policy "enforce" on the node or on a measurement, or state "verified"): - the environment is the built-in one: env_get_location() offers only ENV_IS_NOWHERE, so uboot.env is neither read nor written. Without an enforcing stage the ESP environment works as before, and the nowhere location is not added as a fallback; - the boot starts at once with no key check (bootdelay -2), Ctrl-C is ignored and preboot is empty; - the only boot is EFI/BOOT/BOOTAA64.EFI on the internal ESP through bootefi under UEFI Secure Boot; on failure or return U-Boot resets; - the Secure Boot keys come only from the variable seed built into U-Boot (CONFIG_EFI_VARIABLES_PRESEED; ubootefi.var never restores PK, KEK, db, dbx or the mode variables). board/apple/mac/uefi-seed.bin is an empty seed in a fixed 16 KiB region that ends in the marker AURORA-UEFI-SEED, for aurora-secboot to fill with the owner's keys before it signs Stage 2. With no PK in the seed, U-Boot refuses and resets; - U-Boot adds a measurement@N entry to the record for the EFI application it hands over (stage u-boot, its SHA-256). apple_m1_defconfig enables EFI_SECURE_BOOT (with FIT and FIT_SIGNATURE, which it depends on), EFI_VARIABLES_PRESEED with the empty seed and ENV_IS_NOWHERE. Without an enforcing stage the seed has no PK, Secure Boot stays off and the boot is unchanged. A relative CONFIG_EFI_VAR_SEED_FILE is documented as relative to the source tree, but .incbin only found it in the build directory, so O= builds failed; the source tree is now on that object's include path. tools/aurora_uefi_seed.py checks that an image holds exactly one valid seed region; CI runs it on the apple_m1 build. doc/board/apple/m1.rst describes the policy. Signed-off-by: DjDeveloperr <[email protected]>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Contributor
Author
|
Replaced by #78: the shipped U-Boot is built from aurora-wip, which already measures loaded EFI images, and this main-based change resets before Linux on T6030. |
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.
What: U-Boot follows Aura's enforce policy. When
/chosen/aurora,boot-securityshows an enforcing stage, U-Boot:uboot.env;EFI/BOOT/BOOTAA64.EFIfrom the internal ESP throughbootefiunder UEFI Secure Boot, and resets otherwise.The keys come only from a variable seed built into U-Boot.
apple_m1_defconfigships it empty, in a fixed 16 KiB region with an end marker thataurora-secbootfills before it signs Stage 2. Without an enforcing stage, the boot is unchanged.Tested: no hardware run yet.
apple_m1andapple_j873build withWERROR.tools/aurora_uefi_seed.pyfinds exactly one valid empty seed region in theapple_m1image; CI runs that check, and an image without the region fails it.Risk: two-way · every Mac booting this U-Boot. Without an enforcing stage the seed has no PK and Secure Boot stays off. The UEFI variables
SecureBoot=0andSetupMode=1are now reported, where before Secure Boot support was absent.Not yet:
BOOTAA64.EFIis refused;uboot.envthat would change the boot is ignored, and the same file is applied without enforce;bootdelay=-2, Ctrl-C off, emptypreboot): no host input reaches U-Boot on that rig.build_mem_map()panics there), so they have no row.Details
policyisenforce, or anymeasurement@Nhaspolicy = "enforce", orstateisverified. Without the node, nothing changes.env_get_location()gives onlyENV_IS_NOWHEREunder enforce, so the built-in environment is imported andsaveenvhas nowhere to write.saveenvstill createsuboot.env.-ENODEVfromenv_init).bootcmdisrun aurora_secure_boot; reset, withbootdelay=-2,prebootempty anddisable_ctrlc(1).aurora_secure_bootloadsBOOTAA64.EFI, records its size for the measurement, then runsbootefiwith the control FDT.AURORA_UBOOT_SECURE_FAILand resets.booti, bootflow, script, USB or fallback.apple_seed_has_pk()walks the built-inefi_var_file, bounds-checked), bootcmd only reports and resets.ubootefi.varnever restores PK, KEK, db, dbx, dbt, dbr,AuditModeorDeployedMode(efi_var_restore(..., false)), so only the seed sets them. With PRESEED they are also write-protected.ft_board_setup()runs fromefi_install_fdt()beforeefi_run_image(). It addsmeasurement@N(reg, stageu-boot, policyenforce, componentEFI/BOOT/BOOTAA64.EFI, verdictverified,sha256) in aura's entry format. The image only starts, and so only sees the record, when Secure Boot verified it.lib/efi_loader/Makefile:-I$(srctree)forefi_var_seed.o, so a relative seed path works withO=, as Kconfig documents. Fedora builds withO=build-aurora.apple_j873has no seed or Secure Boot. Under enforce it refuses; the measurement code is built only withEFI_SECURE_BOOT.Evidence
apple_j873also builds withWERROR. The local builds turn offTOOLS_KWBIMAGE/TOOLS_LIBCRYPTO, because this host's OpenSSL 4.1 has no ENGINE API; that is unrelated to this change and also fails onmain. CI uses Ubuntu's OpenSSL.