Skip to content

cdh: add crash-safe persistent LUKS volumes - #1

Open
chalabi2 wants to merge 5 commits into
mainfrom
jc/confidential-persistence
Open

chalabi2 wants to merge 5 commits into
mainfrom
jc/confidential-persistence

Conversation

@chalabi2

@chalabi2 chalabi2 commented Aug 1, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Confidential Akash workloads need durable Block storage whose DEK is released only after attestation. CDH must initialize a new volume and reopen it after a guest restart without treating a transient mount failure as authority to format data.

What changed

  • add an additive sourceType: persistent LUKS2 filesystem path
  • require a stable measured volumeId and signature-verified sealed.* reference
  • bind the fetched DEK to the digest carried in the signed payload
  • initialize only a completely zero, non-LUKS backing device
  • persist initializing and ready state in a volume-bound LUKS label
  • probe mapped content with blkid before mount or format
  • format only an initializing volume with no recognized filesystem
  • fail closed for ready-but-unformatted, foreign, ambiguous, indeterminate, wrong-key, and mismatched-mapper states
  • emit a stable non-secret mount result event for canary proof
  • preserve existing empty and encrypted behavior

The state label supports crash recovery; it is not an anti-rollback mechanism.

Validation

  • formatting and git diff --check pass
  • pure probe and format-authorization cases are table tested
  • an ignored privileged Linux test covers every initialization crash boundary and verifies existing filesystem data is not reformatted
  • the existing persistent lifecycle, wrong-key, foreign-label, mapper, mount-path, and VaultSecret tests remain in place
  • the exact commit is pinned by agent: fail closed and hand persistent volumes to CDH kata-containers#1, which also packages the new blkid runtime dependency

The local macOS host cannot compile the Linux-only loop-device dependency, and this Akash fork does not expose runnable Actions workflows. The privileged loopback test therefore remains a required Linux qualification step before merge.

Scope

This PR does not add anti-rollback, DEK rotation, RIM support, read-only persistent mounts, or a generic wipe fallback. Storage provisioners must still hand CDH a deterministically clean new Block volume.

Add an additive persistent block-device mode that verifies tenant-signed, digest-bound DEKs before non-destructive in-place LUKS2 initialization or reopen. Preserve the legacy empty and encrypted paths, derive stable mapper identities from measured volume IDs, and fail closed on foreign state, ambiguous probes, wrong keys, and unsafe mount configuration.

Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
Confidential image pulls fail on the pinned pre-6.6 guest kernel because libc rejects fchmodat with AT_EMPTY_PATH. Resolve the O_PATH inode through procfs and call chmod so Kata can unpack OCI layers.

Backports confidential-containers/guest-components@dcd55ea16ea4.

Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
Emit one stable success event after persistent LUKS reconciliation so an
operator can prove that the first sandbox formatted the volume and later
sandboxes reopened it. The event contains only the digest-derived mapper and
non-secret state flags.

Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
Replace mount-failure-driven formatting with an explicit blkid probe. Only an initializing volume with no recognized content may be formatted; ready, foreign, ambiguous, and indeterminate devices fail closed.

Add table-driven probe tests and an ignored privileged loopback test that exercises every initialization crash boundary without reformatting existing data.

Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
@chalabi2 chalabi2 changed the title cdh: add content-bound persistent LUKS volumes cdh: add crash-safe persistent LUKS volumes Aug 4, 2026
@chalabi2
chalabi2 marked this pull request as ready for review August 4, 2026 19:11
@cloud-j-luna

Copy link
Copy Markdown
Member

I did not find major correctness issues overall. Just want to raise 2 points. the first-init cost is relevant, given the 1MB ZERO_SCAN_BUFFER_SIZE it would not surprise me if on a 1TB deployment, in a 1 GB/s volume throughput it would take ~15min. That's still quite relevant and should be transparent to the user. Then there is the mutex which seems to block per device, this should be no issue for other tenants but will block on multiple blocks (might just be a performance compromise)

A process-wide lock made every secure mount wait behind first-use scans on
unrelated devices. Key the lock by the resolved device number so path aliases
still serialize while distinct devices initialize concurrently.

Keep the complete zero scan as the authorization boundary for formatting. Log
progress and document its expected cost for large volumes.

Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
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.

2 participants