Repository navigation
stage1: aarch64 sysctl tolerance, arch aliases, PCR replay file, drop init_on_free - #21
Merged
Merged
Conversation
`sysctl -f` now also skips, with a warning, a knob that is present but not writable, not only a missing one. kernel/nmi_watchdog exists on aarch64 but has no NMI watchdog behind it and rejects the write, which died init. It is now marked -f; all other hardening sysctls stay fatal. Makefile: add build-x86_64/build-aarch64/build-amd64/build-arm64 aliases, and drop the `--exclude mkuki --exclude deploy` from the musl stage1 build so the whole workspace is built for the target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stage0 now builds its Secure Boot varstores with tools/mkvarstore.py (stdlib only), so nothing runs virt-fw-vars, and pip was installed only for it. Synced from stage0's canonical copy (workspace `make sync-harness`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HARNESS_TIMEOUT passes qemu-test.sh --timeout through to the harness, so an unattended boot that hangs fails instead of blocking. selftest-<arch> is this repo's part of the workspace `make selftest`: test-chain in every _stage2 admission mode (sha256, sign, sign_args, manifest, fallback) plus smoke-args; a mode passes only if the leaf ran and received stage1's attestation. 300 s per boot on both arches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The uki-v* prefix dates from the pre-split lockboot/lockboot repo, where one workflow carried two release tracks (stage0-v* and uki-v*) and the prefix told them apart. Each repo now releases one product, so every release repo uses plain v* (as vaportpm already does). Workflow trigger, release-job ref checks, and docs updated; release asset names are unchanged. The next stage1 release must sort above the existing v0.1.0 / v0.2.0 pre-releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release attestation covered only the GitHub artifact zips. A consumer can verify a zip and extract from it, but could not verify an extracted file on its own. The release job now unzips both arches and attests, in the same single attestation step, the zips plus every file inside them. Subjects come from a sha256sum-format checksums file (subject-checksums), named <arch>/<path-in-zip>, so the per-arch copies of same-named files stay distinguishable; verification matches by digest. xargs -r keeps an empty listing from hashing stdin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/predict-pcrs.py derives what stage1 adds to the PCRs from linux.efi alone (confirmed event by event against the Linux TCG log of a QEMU stage0 -> stage1 -> stage2 boot): - PCR5: "Exit Boot Services Invocation" / "...Returned with Success". - PCR9: the Linux EFI stub's LoadOptions (UTF-16LE .cmdline + NUL) and the initrd systemd-stub v259 hands the kernel: .initrd padded to 4, then the stub's generated cpio carrying .osrel as /.extra/os-release (reconstructed byte for byte from systemd's cpio.c / stub.c). - PCR11: systemd-stub's name + contents pair for .linux .osrel .cmdline .initrd .uname .sbat. - PCR14: stage1's H_bank(sha256(stage2)), an input. The kernel is not measured into PCR4 (stage0 loads the UKI through its Security2 override); it is covered by PCR14 (whole UKI) and PCR11. UKIs with sections whose PCR9/PCR11 effect has not been verified (.ucode, .pcrsig, .profile, ...) are refused rather than guessed at. --emit-measurements writes only the fixed extends; build.sh emits measurements.json next to linux.efi and CI uploads it, so it ships in the attested release. --stage0 pcrs.json --stage2-sha256 gives the full state at the stage2 handoff (stage0's PCR14 for this UKI added if absent, checked if present). example-stage2 --dump-tpm (opt-in) prints the Linux event log and all PCRs for --check. Verified, all predicted PCRs in four banks: QEMU x86_64 and aarch64. The UKI rebuilds byte-identical with the new build step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The musl stage1 rule ran `cargo build --workspace`, so every crate in the workspace (incl. the host tools mkuki and deploy since 44eef04 dropped their --exclude) was built together for the payload target. Resolver 2 unifies the features of shared dependencies across every package in one invocation, so host-tool dependency features leaked into the measured stage1 binary: building stage1 alone changes it (x86_64 bb12f3a0 -> ea7c72fd, aarch64 b040d7b1 -> 7720b36c), and with it the UKI hash. A host-tool dependency bump could otherwise move PCR14/PCR11 with no change to stage1. mkuki and deploy already have their own rules. Verified: make ci; full-chain QEMU boot on x86_64 and aarch64 with the rebuilt UKIs, every reconstructed PCR matching in four banks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….json tools/predict-pcrs.py now writes stage1's PCR replay file from the UKI: every event systemd-stub, the kernel's EFI stub and ExitBootServices add between stage0's handoff and the stage2 handoff, each with its derivation from linux.efi (PE sections, the stub's generated initrd cpio, the LoadOptions string) and the digests computed here, plus the stage2 input (PCR14). Format and verifier: workspace tools/pcr-replay. build.sh writes it; CI uploads it with the UKI. Verified: make tools/build-uki/<arch>/linux.efi writes it on both arches; QEMU x86_64 and aarch64 full chains reproduce (pcr-replay CHAIN VERIFIES, 30 events re-derived and verified); GCP n2d SEV-SNP full chain verifies with the workspace GCP platform file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… TDX) On GCE c3 Intel TDX, init_on_free=1 kills the TD during early boot on every boot: a silent reset at varying points (ACPI parsing, the boot-time "mem auto-init: clearing system memory", the swiotlb private->shared conversion). Found by bisecting this cmdline one TDX VM per step: every combination with init_on_free=1 died (21/21 boots), every combination without it booted first time, including the full production set minus init_on_free. Cause not understood yet. init_on_alloc=1 stays, so every allocation is still zeroed; what is lost is wiping freed data at free time, which the confidential-VM memory encryption (SEV-SNP / TDX) already covers against the host. One UKI per arch for every cloud, so the option goes everywhere. Verified: GCP c3 TDX and n2d SEV-SNP full chains (stage0 -> UKI -> stage2 pcr-dump) complete; QEMU x86_64 and aarch64 full chains verify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fill-in template predates lockboot-deploy and was wrong for stage0 (https:// URL, no "payload" wrapper), so stage0 rejected it as written. lockboot-deploy create generates the _stage1 document; the template is no longer built or uploaded. linux.efi unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
init:sysctl -fnow also skips, with a warning, a knob that exists but cannot be written (previously it only skipped missing ones).kernel/nmi_watchdogexists on aarch64 but rejects the write, which made init die. It is now-f. Every other hardening sysctl (panic_on_oops,softlockup_panic, ...) stays fatal-on-failure.nmi_watchdog=0was never a hardening knob, so losing it on aarch64 does not weaken fail-closed behaviour.build-x86_64/build-aarch64/build-amd64/build-arm64aliases.cargo build -p stage1), not with--workspace. Resolver 2 unifies shared-dependency features across every package in one cargo invocation, so co-building the host tools (mkuki,deploy) leaked their dependency features into the measured stage1 binary: building it alone changes the bytes (x86_64bb12f3a0->ea7c72fd, aarch64b040d7b1->7720b36c) and so the UKI hash. (An earlier commit on this branch had dropped their--exclude; this supersedes both forms.)Test plan
make ci,build-x86_64,build-aarch64nmi_watchdog=0 skipped (write failed)and continuesSelf-test
HARNESS_TIMEOUTpasses--timeoutto the harness.selftest-<arch>:test-chainin all 5_stage2admission modes plussmoke-args. A mode passes only if the leaf ran and received the stage1 attestation.make selftest, which passed on x86_64 and aarch64 (the aarch64 runs shownmi_watchdog=0 skipped (write failed), after which init continues).PCR replay file
tools/predict-pcrs.py(603dc62, f13596a) writesstage1.replay.json, apcr-replay/v1file (format and verifier: workspacetools/pcr-replay), fromlinux.efialone: every event stage1 adds between stage0's handoff and the stage2 handoff, each with its derivation from the UKI and the digests computed here. Confirmed event by event against the Linux TCG event log of a QEMU stage0 -> stage1 -> stage2 boot:.cmdline+ NUL), then the initrd systemd-stub hands the kernel.linux.osrel.cmdline.initrd.uname.sbatstage2: stage1'sH_bank(sha256(stage2))(bound to the next stage's entry).initrdpadded to 4 bytes followed by systemd-stub v259's generated cpio carrying.osrelas/.extra/os-release, expressed as acpio_newcderivation and rebuilt byte for byte from systemd'scpio.c/stub.c..ucode,.pcrsig,.profile, ...) are refused rather than guessed at.build.shwritesstage1.replay.jsonnext tolinux.efi(replacingmeasurements.json); CI uploads it, so it ships in the attested release.example-stage2 --dump-tpm(opt-in) prints the event log and all PCRs.Verified with
pcr-replay: QEMU x86_64 and aarch64 full chains; GCP n2d SEV and SEV-SNP full chains. The UKI rebuilds byte-identical.Kernel cmdline: drop init_on_free=1
b86bc5a: on GCE c3 Intel TDX,
init_on_free=1kills the TD during early boot on every boot (a silent reset at varying points: ACPI parsing, the boot-time memory clear, the swiotlb conversion). Found by bisecting the cmdline one TDX VM per step: every combination with it died (21/21 boots), every combination without it booted first time, including the full production set minusinit_on_free. Cause not understood yet.init_on_alloc=1stays, so every allocation is still zeroed; what is lost is wiping freed data at free time, which SEV-SNP / TDX memory encryption already covers against the host. One UKI per arch for every cloud, so the change applies everywhere; the reason is recorded next to the cmdline inbuild.sh.Verified: GCP c3 TDX and n2d SEV-SNP full chains; QEMU x86_64 and aarch64 full chains.
Release attestation covers the zip contents
The release job unzips both arches and attests, in the same single step, the 2 zips and the files inside each zip (now 8 per arch with
stage1.replay.json). Subjects come from asubject-checksumsfile named<arch>/<path-in-zip>, so same-named per-arch files stay distinguishable. A consumer can verify the zip and extract from it as before, or verify any extracted file on its own (gh attestation verify <file> --repo lockboot/<repo> --signer-workflow ...). The listing step was tested on real build outputs: each extracted file's digest matches the built file.🤖 Generated with Claude Code