Skip to content

docs(formal): add TLA+ models of the key rotation protocol - #1541

Merged
kvinwang merged 2 commits into
feat/kms-epochs-combinedfrom
docs/key-rotation-model
Nov 9, 2026
Merged

kvinwang merged 2 commits into
feat/kms-epochs-combinedfrom
docs/key-rotation-model

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1533. Adds TLA+ models of the key rotation protocol as implemented, checked exhaustively with TLC (see docs/formal/key-rotation/README.md).

  • KmsRotation: root epoch registry, keyrings, ordinary and rotation joins, key release.
  • DiskMigration: data disk setup and the two-keyslot LUKS migration of fix(kms): address #1533 review on LUKS migration, setters and handover checks #1539, with a crash between any two cryptsetup commands and rotations at any point.
  • EnvUpdate: env re-encryption at boot and the VMM once-per-boot update window, with a lossy host API.

Keys are only released from the registered root of their epoch, handover only passes on registered roots, owner env updates are never overwritten, and no crash or rotation fails a boot or loses the disk key. EnvUpdate.cfg models the fail-closed guest of #1546; EnvUpdateLossy.cfg keeps the earlier guest, where application code can replace the env, as a counterexample.

Earlier versions of these models found issues since fixed: a torn luksHeaderRestore destroying the volume key and an interrupted format failing every boot (#1539), a migration interrupted before a later rotation failing every boot (#1539), a losing pending root passed on by an ordinary join (#1542), and the env window left open (#1546). The README lists the mutations each model catches.

This PR changes no code.

Validation: TLC 2026.11.06 on OpenJDK 21.0.13, Linux 6.8.0-1028-intel x86_64. KmsRotation 3 nodes/4 roots (4,423 states) and 4 nodes/5 roots (57,889 states); DiskMigration epochs 0-3 (828 states); EnvUpdate epochs 0-2, 2 owner updates (267 states).

@kvinwang
kvinwang force-pushed the docs/key-rotation-model branch from 5c2892c to eb57205 Compare November 9, 2026 15:06
Model the root epoch registry and KMS onboarding, data disk key
migration with crashes, and the VMM env update window, as implemented,
and check them with TLC.

The models find that a crash during luksHeaderRestore can destroy the
volume key, that an initialization interrupted before the epoch token
is written fails every later boot, that lost boot notifications leave
the env update window open to application code, and that an ordinary
join can hand over a losing pending root. A model of a fix for the two
disk issues passes.

Signed-off-by: Kevin Wang <wy721@qq.com>
…tation

DiskMigration now models the two-keyslot migration of #1539 (luksAddKey,
token bound to its keyslot, luksKillSlot) instead of luksHeaderRestore, and
lets the KMS rotate at any point of a boot. All invariants hold for epochs
0-3; the torn-restore script and the configs for the replaced scheme go.

KmsRotation checks the latest registered epoch's chain hash on handover, as
onboard_service.rs does since #1542, so HandoverAgreesWithRegistry now holds
and joins the main config.

EnvUpdate gains FailClosed for the guest of #1546, which holds with a lossy
host API; the lossy config keeps the earlier guest as a counterexample.

The README records the mutations each model catches.

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang force-pushed the docs/key-rotation-model branch from eb57205 to 45ed57f Compare November 9, 2026 15:20
@kvinwang
kvinwang merged commit ecaf4e7 into feat/kms-epochs-combined Nov 9, 2026
2 checks passed
@kvinwang
kvinwang deleted the docs/key-rotation-model branch November 9, 2026 15:33
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