capsule trust: a signed kernel refuses an unsigned capsule; the intermediate is the anchor (#139)

capsule_sig_refused(), the one decision at v4's boot and v3's three
births: INVALID always; MISSING and NO_ROOT_KEY on a signed build
(CAPSULE_SIGNED_BUILD, set exactly when the Makefiles sign). A
developer build warns and boots. test_capsule_sig, built both ways,
did not build without it; 4 checks each way now. nightly.sh
capsule-trust, a nightly step: signed, v4:centre.4th left unsigned
(test only), amd64 must refuse it -- CI's, as ruled, since only CI has
the key. No root check, as ruled; the step-4 trust model (blobs signed
by their authors, MANIFEST.md hashes, contributors' intermediates,
snakeoil) recorded as given. FABRIC-3 XLIX. Gates pass, POST 992/992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 22:37:25 +00:00
parent 5425d52cb1
commit 9db364f7c7
20 changed files with 1750 additions and 11 deletions
+7 -1
View File
@@ -249,6 +249,11 @@ MKARTEMIS_BIN = $(BUILD_DIR)/tools/mkartemis
# which boots with a warning per capsule. mkcapsule refuses a key that is not the certificate's.
SIGN_KEY ?=
SIGN_KEY_ARGS = $(if $(wildcard $(SIGN_KEY)),--sign-key $(SIGN_KEY),)
# #139: a kernel whose capsules are signed refuses an unsigned one (capsule_sig.h)
CAPSULE_SIGNED_DEF = $(if $(wildcard $(SIGN_KEY)),-DCAPSULE_SIGNED_BUILD=1,)
# For the test only (#139, scripts/qemu_session.py unsigned_capsule): a signed build with this one capsule's
# signature taken out after mkcapsule, which the kernel must refuse. Never set for a build that ships.
CAPSULE_TEST_UNSIGN ?=
CAPSULE_GENERATED = $(BUILD_DIR)/capsule_generated.c
CAPSULE_GENERATED_OBJ = $(BUILD_DIR)/capsule_generated.o
CAPSULE_GENERATED_KOBJ = $(KERNEL_OBJ_DIR)/capsule_generated.o
@@ -435,7 +440,7 @@ DOE_SEED ?= 12345
# production default (Kconfig.heartbeat's own default n, same decision).
$(eval $(call kconfig_bool,EMERGENCY_CONSOLE_ENABLED,0))
LOADER_CFLAGS := $(LOADER_BASE_CFLAGS) -I$(KERNEL_SRC)/vm
KERNEL_CFLAGS := $(COMMON_CFLAGS) -D__STARKERNEL__ -I$(KERNEL_SRC)/vm
KERNEL_CFLAGS := $(COMMON_CFLAGS) -D__STARKERNEL__ -I$(KERNEL_SRC)/vm $(CAPSULE_SIGNED_DEF)
# Linker flags
ifeq ($(ARCH),aarch64)
@@ -859,6 +864,7 @@ $(CAPSULE_GENERATED): $(MKCAPSULE_BIN) $(CAPSULE_SRCS)
@mkdir -p $(dir $@)
@echo " MKCAP $(CAPSULES_DIR) -> $@"
@$(MKCAPSULE_BIN) $(SIGN_KEY_ARGS) $(CAPSULES_DIR) $@
@$(if $(CAPSULE_TEST_UNSIGN),python3 scripts/capsule_unsign.py $@ $(CAPSULE_TEST_UNSIGN),:)
@echo " MKCAP $(CAPSULES_DIR) -> $(CAPSULES_DIR)/BLOCK_MAP.md"
@$(MKCAPSULE_BIN) --manifest $(SIGN_KEY_ARGS) $(CAPSULES_DIR) $(CAPSULES_DIR)/BLOCK_MAP.md