Repository navigation
Reboot after a GPT rewrite before deriving the data key; bind PCR5 - #5
Merged
Merged
Conversation
The firmware measures the GPT the boot started with (PCR5; PCR2 on GCE TDX, together with stage0's Authenticode). The data key was derived before ensure_partitions() rewrote it, so on TDX, where PCR2 must stay bound, the key moved at the first reboot and /data was lost once. - ensure_partitions() returns whether it wrote the GPT; a rewrite is read back from the device (BLKFLSBUF first) and must show p3 ending at the last usable LBA, else fail closed rather than reboot into the same rewrite. - bootstrap: after a GPT write, sync and reboot before deriving anything; the key is derived after ensure_partitions(). - DATA_KEY_PCRS binds PCR5 (all but PCR10). Growing the volume changes the key: /data is reinitialized. - PCR-BINDING.md: 2026-11-14 resolution. Tested: make ci; selftest x86_64 + aarch64 (pivot, grow); GCP pivot reboot test on n2d SEV-SNP and c3 TDX: /data survives the post-provisioning reboot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-resolves only Cargo.lock's vaportpm-attest entry after bumping the rev in crates/tpm-derive/Cargo.toml (builds are --locked; `make lock` re-resolves every dependency). Same target as stage1's. Used by the vaportpm repin step in workspace RELEASING.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Repin tpm-derive from v0.3.0 (7041f46) to the v0.4.1 release commit 157ec04, guard =0.4.1. derive.rs, session.rs and pcr.rs are unchanged between them, so the derived keys are the same. Cargo.lock: only the vaportpm-attest entry (make update-vaportpm). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
action-gh-release with draft: false publishes the release before uploading its assets; an immutable release accepts no uploads once published, so the first tagged release would ship empty (vaportpm v0.4.0 did, vaportpm#14). Create it as a draft with the assets, then publish with `gh release edit --draft=false`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The reboot-test payload now prints, on every boot it reaches, the evidence an off-machine check needs (workspace tools/cloudtest/check-run.py): the config digest bound into PCR15, stage1's attestation as base64 between the markers vaportpm-verify accepts, and every PCR as 'PCR <bank> <nn> <hex>' (pcr-replay --check). It waits 3 s before a reboot or power-off so the serial console drains. Test payload only. Tested: make ci; selftest (pivot, grow) on x86_64 and aarch64; GCP n2d SEV, n2d SEV-SNP and c3 TDX (cloudtest be236c1f6330): the attestation verifies and the PCRs replay on both payload boots, /data survives the reboot. Co-Authored-By: Claude <noreply@anthropic.com>
HarryR
marked this pull request as ready for review
November 18, 2026 09:26
HarryR
added a commit
to lockboot/stage0
that referenced
this pull request
Nov 18, 2026
…ithout a debug record; publish scripts verify the release tag (#14) Part of the GCP release changeset: with lockboot/stage1#22, lockboot/stage2#5 and lockboot/workspace#6, on top of vaportpm v0.4.1 (lockboot/vaportpm#12). **PCR replay** - `predict-pcrs.py` marks stage0's EV_EFI_GPT_EVENT `"from_attestation": "gpt"`, so workspace pcr-replay takes that event's digest from the attestation and reproduces PCR5 (PCR2 on GCE TDX) on every boot, not only before stage2 rewrites the GPT. `pcrs.json` stays the first-boot reference. **Reproducible build** - The UEFI targets link with `/DEBUG:NONE`. CI's `stage0.efi`, `ena.efi` and `gvnic.efi` each differed from a local build of the same commit in 8 bytes: the GUID of the linker's debug record, a hash of the `.pdb`, which records where the toolchain is installed (`/tmp/.rustup` in CI, `/src/.rustup` locally). The Authenticode hash and PCR4 differed with it. No `.pdb` is written now and the image carries no debug record. This changes the measured stage0 binary. - `os-release`'s `yy.mm` version is the committer date (UTC) of the commit being built, not the build date. **Release and publish tooling** - CI: the release job creates the release as a draft with its assets, then publishes it. Publishing first leaves an immutable release empty, as vaportpm v0.4.0 was (lockboot/vaportpm#14). - `tools/publish/{ec2,gcp}/create.sh`, release path: `gh attestation verify` gains `--source-ref refs/tags/<version>` (the provenance must come from a build of that tag), and `gh release verify-asset` checks the zip is an asset of the immutable release. - Both scripts read `os-release` as data instead of sourcing it. **Tested** - Workspace `make selftest`, x86_64 and aarch64. - CI's build equals the local build on both arches: PCR4 in `pcrs.json` is identical, and the body of CI's signed `BOOT*.EFI` is byte-identical to the local unsigned `stage0.efi` (PCR7 differs: the Secure Boot keys are minted per build). - GCP release gate (workspace `tools/cloudtest`, 2026-11-18, run be236c1f6330) on n2d SEV, n2d SEV-SNP and c3 TDX, with the image built from this branch: stage1's attestation verifies and every PCR replays against the golden platform files on both payload boots. The gate ran before the debug record was removed and is not re-run. - The two `gh` checks against lockboot/vaportpm v0.4.1 (its tag passes; another tag and refs/heads/main fail); the os-release parser on a good, a hostile and an incomplete file. **Not tested** - `create.sh <arch> <tag>` end to end and the draft-then-publish release job: both need this repo's first tag. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
HarryR
added a commit
to lockboot/stage1
that referenced
this pull request
Nov 18, 2026
…rom the commit (#22) Part of the GCP release changeset: with lockboot/stage0#14, lockboot/stage2#5 and lockboot/workspace#6, on top of vaportpm v0.4.1 (lockboot/vaportpm#12). **GPT digests in the attestation** - stage1 finds the boot disk (stage2's `find_boot_device` rules, duplicated for now), reads its GPT and passes H(UEFI_GPT_DATA) (sha256 + sha384) to vaportpm's `attest()`, which now requires it. A verifier uses it to replay the PCR the firmware's EV_EFI_GPT_EVENT extended (PCR5; PCR2 on GCE TDX) after stage2 has rewritten the GPT. - vaportpm-attest pinned to the v0.4.1 release (157ec04, guard =0.4.1). `make update-vaportpm` re-resolves Cargo.lock after changing the rev. **Kernel** - Fedora CoreOS stable 44.20261023.3.1: kernel 7.0.12-201 -> 7.2.11-200.fc44, systemd-boot stub 259.6-1 -> 259.10-1.fc44. Fixes picked up include a container escape in IP fragment handling (7.0.14), CVE-2026-68480 (Safe-RET bypass, AMD) and CVE-2026-80590 (IP fragment reassembly panic). - Kernel 7.2 has no `crypto/hkdf.ko` (nvme-auth no longer depends on it): dropped from the initramfs module list and from `init`, which otherwise stops the boot. - `build.sh` extracts exactly the kernel RPMs `fedora-deps.mk` pins instead of `kernel-core-*.rpm`, and `update-fedora-deps` removes the previous versions' RPMs. Before, a bump without a clean rebuilt the old kernel silently. **UKI version string** - The `os-release` embedded in the UKI carried the build date's `yy.mm`, so a commit built a different UKI in a different month. It is now the committer date (UTC) of the commit being built. - Its Fedora tag is the dist tag of the kernel `fedora-deps.mk` pins (`fc44`); it was a hardcoded `fc41`. **Release tooling** - CI: the release job creates the release as a draft with its assets, then publishes it (an immutable release takes no uploads after it is published). - `release-docker` gains `docker/setup-qemu-action` (it builds linux/arm64 layers on an amd64 runner). - The `uki-<arch>` artifact, and so the release zip, is flat again: the build job collects the release files into one directory. Since `build/<arch>/stage2` joined the upload list the artifact had been rooted at the repo root, and `release-docker`'s download into `tools/build-uki/<arch>` would have nested the files where `Dockerfile.runtime` does not look. The release job still extracts each zip into `contents/<arch>`, so attestation subjects stay distinct (`<arch>/<file>`). - `tools/publish.sh` removed: it uploaded every UKI to the same object name and printed a `_stage1` snippet stage0 rejects. `lockboot-deploy create` replaces it. **Tested** - `make ci`; workspace `make selftest`, x86_64 and aarch64, with 7.2.11 confirmed in the boot logs. - CI's artifact is flat, and every file in it is byte-identical to the local build on both arches. UKIs: x86_64 `fecbe639b4bb9fa0`, aarch64 `fef50d8d91a5510f`. - GCP release gate (workspace `tools/cloudtest`, 2026-11-18, run be236c1f6330) on n2d SEV, n2d SEV-SNP and c3 TDX with the UKI as it was before the version-string change (`e0bc2bbc860aa046`; not re-run): on both payload boots the attestation verifies against Google's root, its nonce is sha256(stage2), and the quoted PCRs replay against the golden platform file with the attested GPT digest. **Not tested** - The release jobs (draft-then-publish, `release-docker`): they run only on a tag. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Part of the GCP release changeset: with lockboot/stage0#14, lockboot/stage1#22 and lockboot/workspace#6, on top of vaportpm v0.4.1 (lockboot/vaportpm#12).
The firmware measures the GPT a boot started with (PCR5; PCR2 on GCE TDX, together with stage0's Authenticode). The data key was derived before
ensure_partitions()rewrote the GPT, so on TDX, where PCR2 must stay bound, the key moved at the first reboot and /data was lost once.Data key
ensure_partitions()returns whether it wrote the GPT. A rewrite is read back from the device (buffer cache dropped) and must show p3 ending at the last usable LBA, else the boot fails closed instead of rebooting into the same rewrite.DATA_KEY_PCRSbinds PCR5 (all but PCR10). Growing the volume changes the key, so /data is reinitialized.Dependencies and tooling
make update-vaportpmre-resolves only that lock entry.pivot-initprints the config digest, stage1's attestation and every PCR on each boot, for the off-machine check in workspacetools/cloudtest.Tested
make ci;make selftest-x86_64/selftest-aarch64(pivot, grow); workspacemake selftest, both arches.tools/cloudtest, 2026-11-18, run be236c1f6330) on n2d SEV, n2d SEV-SNP and c3 TDX: one provisioning reboot, then /data survives the next reboot (data_reinit=false, sentinel present); the final PCRs, including PCR14 and PCR15, replay withstage2.replay.jsonon both payload boots.Not tested
🤖 Generated with Claude Code