Skip to content

Add Linux NVMe preparation action - #40

Open
jonathanbrenes wants to merge 9 commits into
Azure:mainfrom
jonathanbrenes:feature/nvme-action
Open

jonathanbrenes wants to merge 9 commits into
Azure:mainfrom
jonathanbrenes:feature/nvme-action

Conversation

@jonathanbrenes

@jonathanbrenes jonathanbrenes commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a built-in, fix-only alar nvme action with offline guest-kernel/device
resolution, RHEL 7 standalone EFI correction and local ADE refusal.

Run alar nvme directly. No external command, report or dependency is required.

Preparation safeguards

  • Verify actual NVMe PCI and Hyper-V PCI modules for each installed guest kernel
    and its distribution-specific boot images. Reject missing required images,
    failed inspections/rebuilds and unavailable drivers after rebuilding.
  • Correct fallback rule dollar escaping and namespace-attribute matching.
  • Support multi-letter SCSI names and UUID-only queries. Any unresolved legacy
    entry leaves the original fstab unchanged and fails preparation.
  • Propagate NVMe script/mutation failures through unmount/cleanup; do not run
    later actions or emit successful-recovery telemetry after a failure.
  • Preserve existing non-NVMe child-exit behavior and fix-only action usage.

Local ADE safeguards and boundary

ADE credentials, an attached BEK VOLUME, existing recovery-key metadata or
known unlocked ADE mappings refuse an invocation containing NVMe before
discovery. Encrypted/unknown recovery partitions are refused before unlocking.
The guard does not mount key disks or read key contents. Probe errors refuse
NVMe. Other actions retain their ADE behavior.

A genuine BEK catches data-only ADE even with a plaintext recovery OS. Unlocked
ADE is still encrypted.

Important live-verified boundary: attaching an encrypted disk to an existing
rescue does not itself guarantee a BEK volume. The documented automatic-BEK
workflow attaches the encrypted disk at rescue VM creation. Usage now links
Microsoft's workflow.
An offline disk cannot reveal unattached data disks or omitted keys. The repair
workflow/operator must ensure the original VM has no OS/data-disk ADE; this
local guard is not standalone Azure VM-wide certification.

Scope

Eight runtime/usage files. No shipped test suite, packages, cloud API calls,
health-check modes, controller/size changes or ADE-classifier rewrite.
Copyright/license notices remain; current code/docs have no unapproved dependency.

Runtime tested at aaebb79cc1aad4dec499b1155b0f67d216b41ce7.
Follow-up caa224f7730454a27d9d2a47898bce6765f6c818 changes README only;
git diff aaebb79 HEAD -- src confirms the runtime is unchanged.

Local validation

Command/check Result
cargo check --locked --offline --target x86_64-unknown-linux-gnu PASSED
cargo test --locked --offline --target x86_64-unknown-linux-gnu PASSED: existing Rust test
cargo build --release --locked --offline --target x86_64-unknown-linux-gnu PASSED from exact canonical Git bytes
External payload regressions PASSED: 15 tests, 7 subtests
Verbatim main/action with synthetic dependencies PASSED: 6 failure-flow cases
Current executable in synthetic chroots PASSED: 30 local ADE/admission cases
Unchanged standalone local-guard Rust tests PASSED: 6
bash -n, git diff --cached --check, embedded-payload/scope checks PASSED
cargo fmt --check, preserved-baseline comparison Existing baseline formatting also fails; unrelated formatting unchanged

The existing Rust telemetry test emits its normal test telemetry.

Focused live validation — 2026-11-25

All harnesses/evidence remain outside this PR. No production correction was
needed during live testing.

Exact command/scenario Result
cargo build --release --locked --offline --target aarch64-unknown-linux-gnu -j 4; cargo test --locked --offline --target aarch64-unknown-linux-gnu -j 4 PASSED on native ARM64
CC_aarch64_unknown_linux_musl=musl-gcc CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc cargo build --release --locked --offline --target aarch64-unknown-linux-musl -j 4 PASSED; static AArch64 ELF, exact embedded payload and version/help verified
python3 -B plain_case.py arm PASSED: Ubuntu 24.04 ARM64 built-in apply/repeat on cold clone; prepared SCSI boot, two NVMe boots with runtime timeout 240, SCSI rollback
python3 -B plain_case.py x64 PASSED: equivalent Ubuntu 24.04 x64 clone recovery and real boot sequence
Genuine data-only ADE/BEK; nvme and fstab,nvme PASSED: refused before any action; protected-file fingerprints on the plaintext OS copy unchanged
python3 -B resume_data_ade.py --use-diagnostic-attachments PASSED: actual encrypted copy unlocked read-only using the existing opaque key-file path; known mapping still refuses NVMe; existing fstab action completes on the plaintext recovery copy with genuine BEK present
python3 -B os_ade_after_encryption.py PASSED: wait for completed OS ADE, prove actual encrypted root, cold-clone, refuse both invocations without BEK and before unlock/repair; whole-disk write counter stays zero
python3 -B close_campaign.py PASSED: all 10 exact owned VMs deallocated, on SCSI and original OS disks; rescue copies detached

Eight distinct real boot IDs were captured across the plaintext roundtrips.
Full guest logs were retrieved and hash-verified, not inferred from RunCommand's
outer success status. Genuine ADE was never switched to NVMe.

Initial oversized transfers and missing/already-mounted/suffixed-BEK setup
preconditions were recorded explicitly and corrected only in the external
harness. Failed preconditions were not reported as successful action tests.
No key contents were printed/exported; cryptsetup consumed the existing file
directly. The NVMe guard itself only inspected metadata.

Exactly three new private two-vCPU test VMs and a test-only vault were used.
Original disks, cold snapshots/clones, and old/new ARM artifacts are retained.
No broad deletion, public endpoint for new guests, network opening or tenant
policy relaxation. All used VMs finished deallocated.

Evidence: 1,820 sealed files; manifest SHA256
7233bf0d512daaf7bcc6b9031f6332f731eb8236f5ab883f9e9c437b47a5c1c7.

Payload SHA256:
db573d46a043db39d1dab5d6b208dce140191e5bfca41c1bdaba04a0b750b6fe.
Native ARM64 static executable SHA256:
ae370e6852cb180da4d0affa6980a0a9859a2a197f945537686df0cd49330b0d.

Remaining coverage boundaries

This is focused Ubuntu 24.04 plaintext and Ubuntu 22.04 ADE acceptance, not a
new all-distro matrix. Native RunCommand does not certify SSH.
Existing-action isolation used a plaintext recovery copy on a genuine data-ADE
host; encrypted-OS unlocking compatibility with its own supplied key is not
claimed. Earlier RHEL/Oracle evidence remains historical. The temporary Oracle
classifier correction is still reverted and existing false-positive layouts
remain refused. Draft for review.

jonathanbrenes and others added 4 commits November 24, 2026 18:04
Embed the shared Linux preparation script with guest-kernel/device adapters
and the tested RHEL 7 standalone EFI timeout correction.

Add self-contained action regressions and optional shared-source fixtures.
Document the unchanged Oracle framework limitation and SSH acceptance gap;
keep ADE and session-specific deployment tooling outside this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove unused check/dry-run flags, staging and non-fix branches while
preserving default repairs and the optional equivalent -fix argument.

Retain every shared-source fix/error scenario, update the self-contained
regressions and document the narrower interface and historical live scope.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the developer test harness separately and remove it from the
contribution. Keep only the action, minimal built-in wiring and usage
documentation, including the unchanged Oracle framework limitation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require a fresh root-owned source-VM check report covering OS and data disks
before discovery or repair. Refuse encrypted or unknown guest partitions
before ADE setup and keep other actions' recovery behavior unchanged.

Keep the regression harness external and document the trusted report handoff.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jonathanbrenes and others added 4 commits November 25, 2026 06:48
Restore standalone invocation and remove the JSON report input/parser.
Refuse local BEK volumes, key files and unlocked mappings before discovery,
including ADE-aware data-disk-only recovery with a plaintext OS disk.

Keep encryption/probe-error refusal, other actions' ADE behavior and the
external test harness; document the offline coverage boundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the NVMe action directly in usage and source comments, and name
ALAR in the fallback rule's installer comment. Preserve Microsoft copyright
and license notices and all operational behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Strengthen the existing driver, UUID and udev preparation paths and clean
up on NVMe child failures without adding modes or a shipped test suite.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the live-verified manual-attachment boundary and link the
Microsoft automatic-BEK workflow. Runtime code remains unchanged from
the native ARM64/x64 and genuine ADE-refusal tested candidate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanbrenes

Copy link
Copy Markdown
Contributor Author

Focused live testing is complete for runtime commit aaebb79.

  • Native ARM64 GNU/static-musl builds and x64/ARM64 actual clone recovery passed.
  • Both plaintext architectures passed apply/repeat, two real NVMe boots with timeout 240, and SCSI rollback. Original OS disks were restored.
  • Genuine data-only ADE/BEK, a real read-only unlocked copy, and genuine OS ADE were correctly refused before repair. The existing fstab action still ran on a plaintext recovery copy with the genuine data-ADE/BEK context present.
  • All 10 owned VMs finished deallocated on SCSI with their original OS disks. Three new private test guests were used; originals, snapshots/clones and artifacts are retained.

Live setup confirmed an important existing boundary: adding an encrypted disk to an already-created rescue does not itself provision a BEK. Automatic BEK provisioning belongs to the documented creation-time workflow. README clarification in caa224f records this; runtime code is unchanged.

The updated PR description includes commands/results and coverage limits. No ADE controller conversion, key export, network opening or policy relaxation occurred. The 1,820-file evidence manifest is sealed with SHA256 7233bf0d512daaf7bcc6b9031f6332f731eb8236f5ab883f9e9c437b47a5c1c7.

@jonathanbrenes
jonathanbrenes marked this pull request as ready for review November 25, 2026 19:57
Use installed kernel package files and boot references instead of module directories. Ignore module-only kmod-kvdo and debug/header artifacts while preserving genuine missing-image failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.

1 participant