Skip to content

test: diagnose post-bind enclave storage propagation - #9532

Merged
lpcox merged 2 commits into
mainfrom
diag/enclave-storage-verification
Oct 7, 2026
Merged

lpcox merged 2 commits into
mainfrom
diag/enclave-storage-verification

Conversation

@lpcox

@lpcox lpcox commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Observed failure and research

The v0.28.43 environment probe 37571367739 passed storage-propagation-set, immediate storage-propagation, layout, local binds and invocation mount. bounded-runtime/storage-verification then failed with storage-mount-propagation. All bounded cleanup checks passed. Snapshot binding, guest startup and gateway readiness were not attempted. No diagnosis-registry record matches this specific failure; this PR does not claim a confirmed root cause or implement a speculative fix.

Leading hypothesis: the separate invocation bind destination. prepareTrustedInvocationStorage() binds the private allocation's state onto plan.invocationHostDir under run.invocationsDir, outside the allocation. Making the source allocation private does not privatize that destination's covering mount. The previous Linux fixture changed the allocation parent but left this separate destination under a private namespace.

Primary-source research:

  • Linux shared-subtree bind semantics: binding a private source onto a shared destination creates a shared clone.
  • Linux v6.8 attach_recursive_mnt(): the destination shared-state check leads to set_mnt_shared() on the attached tree. This verifies the mechanism, not the runner's unrecorded exact kernel version.
  • mount namespaces: propagation is per-mount, not per-superblock or a recursive promise for all bind destinations.
  • mount(8): remount,bind changes mount flags; it does not automatically change propagation.
  • mountinfo format: optional fields, exact mountpoints, IDs and hidden/stacked ancestors require separate treatment.

The probe fingerprint is v0.28.43, workflow-configured GitHub-hosted Ubuntu 24.04 x86_64, primary Docker/script CH configuration, no model provider/credential, and the workflow GitHub token for release attestation/public seed access. Exact kernel and DOCKER_HOST are unverified; runtime/storage is the failing boundary, not guest networking or authentication.

Five falsifiable hypotheses

# Hypothesis Evidence that can disprove it for the observed failure
1 Private state source acquires shared propagation at the external shared invocation destination A known non-shared covering destination, or a uniquely private invocation immediately after bind, excludes immediate shared-destination inheritance at that observation. Private source → shared destination → one shared invocation supports it, subject to race limits.
2 Allocation root regains non-private propagation after the initial private check A uniquely private root in the failing verification table excludes the root as that guard's culprit. Initial/private, post-layout and verification observations bound the transition interval.
3 A local artifact/run/rootfs child bind or remount introduces non-private propagation Private local-role observations after layout and at verification exclude those roles. Invocation after-bind/after-remount observations separately distinguish a helper-time transition.
4 The propagation error actually means ambiguous duplicate entries, not one shared mount One exact entry at the failed role excludes ambiguity. Unique vs repeated/mixed ID classes distinguish distinct mounts from row repetition, without adopting either.
5 The expected exact entry is missing following removal or a path/view mismatch An exact entry excludes absence. Zero entries with normalized-only spelling vs no normalized match discriminate path representation from broader absence, but do not prove a namespace mismatch or identify the actor.

Hypotheses 4/5 are lower-confidence: journal verification passed before the failing propagation guard, so they require a subsequent change/different table observation. Read/parse/journal failures are separately reported, not mislabeled as any of these hypotheses.

Diagnostics and tests

  • Add nine origin subchecks in storage-verification: journal identity, mountinfo read/observation, and the six fixed mount roles. Every applicable role still requires the original private propagation and mount options. The snapshot check is optional only while no sealed snapshot exists. Catalog: 188 IDs; existing checklist schema version stays 1.
  • Publish bounded storagePropagation evidence before/after invocation bind/remount, after initial private verification/local layout, and for every role from the exact single table used by verification guards, before the first role can fail.
  • Evidence exports only fixed role/phase keys, propagation/location classes and compact enum tuples for count/propagation/ID relationship/path-match relationship. No raw IDs, paths, sources, namespaces, device numbers, rows, stderr or filesystem contents. The checked-in schema includes the code legend.
  • A stacked covering ancestor is unknown, never authority to choose a topmost mount. Normalized-only observations never weaken exact matching.
  • Wire evidence through reporter → cumulative startup state → protected descriptor → strict harness sanitizer. Deep-copy tuples; retain evidence after cleanup/active-scope omission; reset on new startup/allocation and clear verification slots before each attempt so failed later reads cannot inherit earlier success.
  • Add deterministic hypothesis fault cases, misleading subsequent-read regressions, helper remount transition, read/malformed/journal failures, per-role residual propagation, readiness blocking, sentinel redaction, strict shape/enum rejection, and maximum-size descriptor coverage.
  • Extend gated real Linux reproduction with a separately shared invocation destination beneath private/shared allocation parents. Require invocation-state rejection, private root/local roles, shared invocation after bind/remount, no snapshot attempt and ordinary identity-checked cleanup. All synthetic shared mounts remain in disposable private namespaces.

The new full catalog/evidence combination exceeds the old descriptor budget if a maximum optional fatal message is also retained. Compact four-code tuples and the existing duplicate-active-scope omission keep the complete checklist/evidence; if needed the optional message becomes the existing explicit message-bound placeholder. The 16 KiB limit is unchanged and tested at worst-case enum/reason sizes. No success-shaped fallback is introduced.

Validation and scope

  • Exact deterministic CI selection: 43 suites / 1,439 tests passed.
  • Final targeted regression/publication selection: 5 suites / 320 tests passed.
  • Build, type-check, bundle, normal source ESLint/pre-commit lint (0 errors; existing warning patterns), Markdown lint, registry validation/sync, harness syntax and diff checks passed.
  • 11 opt-in privileged Linux tests compile but are skipped/unverified on macOS. No live acceptance claim, privileged dispatch, conformance label, release or merge was performed.
  • No propagation command, source trust, role storage ceiling, exact-one-match capture, journal identity or ordinary fail-closed cleanup policy is relaxed. No topmost selection, deduplication, retries, lazy unmount or cap enlargement.
  • Pre-existing untracked docs/research/ is untouched; the intentionally unmerged sharp fix is not included.

Rollout

After review/merge, publish a new immutable release containing this commit and authorize the release-pinned script-only environment probe. v0.28.43 cannot acquire these diagnostics through another dispatch. The probe must supply the missing role/phase evidence before selecting a fix; this PR does not claim enclave startup is repaired.

Record bounded source/destination and per-role mount observations around invocation binds.
Identify the failed storage verification role without changing private mount enforcement.
Cover five propagation hypotheses, shared destination fixtures, redaction and descriptor bounds.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 04:45
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-9532 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 4d92604

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Unresolved correctness issues and unverified privileged Linux reproductions require fixes and human validation.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds bounded diagnostics to investigate Cloud Hypervisor enclave storage propagation failures without claiming a startup fix or relaxing existing guards.

Changes:

  • Records propagation evidence by mount role and startup phase.
  • Preserves sanitized evidence within the existing descriptor limit.
  • Adds fault cases, gated Linux reproductions, and investigation documentation.
File Description
src/​enclave/​startup-progress.ts Retains and resets propagation evidence.
src/​enclave/​startup-progress.test.ts Tests retention, copying, and reset.
src/​commands/​main-action.ts Bounds diagnostic messages while preserving evidence.
src/​commands/​main-action-startup-diagnostics.test.ts Tests maximum-size diagnostic publication.
src/​cloud-hypervisor/​trusted-enclave-storage.ts Captures phase evidence and role-specific checks.
src/​cloud-hypervisor/​trusted-enclave-storage.test.ts Adds diagnostic failure regressions.
src/​cloud-hypervisor/​storage-propagation-schema.json Defines bounded evidence codes and slots.
src/​cloud-hypervisor/​mount-topology.ts Adds propagation observation and validation helpers.
src/​cloud-hypervisor/​mount-topology.test.ts Tests classification and strict evidence validation.
src/​cloud-hypervisor/​host-preflight-schema.json Adds storage-verification checks.
src/​cloud-hypervisor/​host-preflight-progress.ts Publishes copied propagation evidence.
src/​cloud-hypervisor/​enclave-mount-capture.integration.test.ts Adds shared-destination Linux reproductions.
scripts/​ci/​cloud-hypervisor-enclave-live-smoke.test.ts Tests evidence sanitization and retention.
scripts/​ci/​cloud-hypervisor-enclave-live-smoke.js Sanitizes the new diagnostic payload.
docs/​diagnostics/​README.md Links the post-bind investigation guidance.
docs/​cloud-hypervisor-foundation.md Documents hypotheses, evidence, and rollout limits.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cloud-hypervisor/mount-topology.ts Outdated
Comment on lines +119 to +122
if (new Set(candidates.map((mount) => mount.mountPoint)).size !== candidates.length) return 'unknown';
const longest = candidates.reduce((maximum, mount) => Math.max(maximum, mount.mountPoint.length), 0);
const matches = candidates.filter((mount) => mount.mountPoint.length === longest);
return propagation(matches.length === 1 ? matches[0] : undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in d48983a: covering candidates must form a parent-ID ancestry chain; hidden or incompatible mount trees now report unknown. Added the distinct-mountpoint hidden-descendant regression.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 92.98% 93.01% 📈 +0.03%
Statements 91.47% 91.51% 📈 +0.04%
Functions 90.15% 90.19% 📈 +0.04%
Branches 85.17% 85.25% 📈 +0.08%
📁 Per-file Coverage Changes (5 files)
File Lines (Before → After) Statements (Before → After)
src/cloud-hypervisor/host-preflight-progress.ts 100.0% → 100.0% (+0.00%) 95.9% → 96.0% (+0.11%)
src/cloud-hypervisor/mount-topology.ts 100.0% → 100.0% (+0.00%) 100.0% → 99.1% (-0.86%)
src/commands/main-action.ts 95.9% → 95.9% (+0.05%) 95.9% → 96.0% (+0.05%)
src/cloud-hypervisor/trusted-enclave-storage.ts 92.5% → 93.4% (+0.90%) 90.4% → 91.6% (+1.15%)
src/log-directory-setup.ts 96.8% → 100.0% (+3.18%) 96.9% → 100.0% (+3.13%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox

lpcox commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

⏳ Copilot review left inline comments.

@lpcox To proceed:

  1. Ask @copilot to address the review feedback (reply to this comment or the review thread)
  2. Once the fix is pushed, add the ready-for-aw label to trigger agentic CI smoke tests

@lpcox
lpcox merged commit 681e932 into main Oct 7, 2026
31 checks passed
@lpcox
lpcox deleted the diag/enclave-storage-verification branch October 7, 2026 05:11
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.

3 participants