Skip to content

Reboot after a GPT rewrite before deriving the data key; bind PCR5 - #5

Open
HarryR wants to merge 6 commits into
mainfrom
grow-then-reboot
Open

HarryR wants to merge 6 commits into
mainfrom
grow-then-reboot

Conversation

@HarryR

@HarryR HarryR commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • bootstrap: after a GPT write, sync and reboot before deriving anything; the key is derived only on a boot that wrote nothing.
  • 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_PCRS binds PCR5 (all but PCR10). Growing the volume changes the key, so /data is reinitialized.
  • PCR-BINDING.md: the 2026-11-14 resolution, including the rejected PCR7 alternative.

Dependencies and tooling

  • tpm-derive: vaportpm-attest v0.4.1 (157ec04, guard =0.4.1), from v0.3.0. derive/session/pcr are unchanged, so derived keys are the same. make update-vaportpm re-resolves only that lock entry.
  • 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).
  • Test payload pivot-init prints the config digest, stage1's attestation and every PCR on each boot, for the off-machine check in workspace tools/cloudtest.

Tested

  • make ci; make selftest-x86_64 / selftest-aarch64 (pivot, grow); workspace make selftest, both arches.
  • GCP release gate (workspace 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 with stage2.replay.json on both payload boots.

Not tested

  • A volume grown after first boot on real hardware (expected: grow, reboot, /data reinitialized), and the draft-then-publish release job, which runs only on a tag.

🤖 Generated with Claude Code

HarryR and others added 6 commits November 14, 2026 23:50
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 HarryR changed the title bootstrap: reboot after a GPT rewrite, then derive; bind PCR5 Reboot after a GPT rewrite before deriving the data key; bind PCR5 Nov 18, 2026
@HarryR
HarryR marked this pull request as ready for review November 18, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant