Skip to content

fix(enclave): privatize invocation mount beneath shared destination - #9536

Merged
lpcox merged 2 commits into
mainfrom
fix/enclave-invocation-private
Oct 7, 2026
Merged

lpcox merged 2 commits into
mainfrom
fix/enclave-invocation-private

Conversation

@lpcox

@lpcox lpcox commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

The v0.28.44 environment probe (run 37576714531), using #9532 diagnostics, failed only storage-verification/invocation-state with storage-mount-propagation. Cleanup passed.

Evidence Value
invocationLocation outside
sourceBeforeBind / destinationBeforeBind private / shared
invocationBeforeBind [0,5,0,2] (no entry)
invocationAfterBind, invocationAfterRemount, invocationVerified [1,1,1,0] (one exact shared entry)
Root, artifacts, runs, rootfs after layout and at verification [1,0,1,0] (one exact private entry)

This supports hypothesis 1. The private <allocation>/state source is bound beneath a shared external invocation destination, so Linux shared-subtree semantics make the new mount shared. For this failure, the evidence disproves the other four hypotheses: root re-sharing, local child sharing, duplicate entries, and a missing or misspelled entry.

Fix

In mountTmpfs, after the identity-journaled bind is captured:

  1. Re-verify the storage journal.
  2. Run a non-recursive mount --make-private <invocation-state> on only that captured mount.
  3. Apply the existing restrictive remount.
  4. Require invocationAfterRemount to be exactly one private entry; otherwise fail with storage-mount-propagation.

The shared destination's covering mount, the host namespace, and all other mounts are unchanged. Existing cleanup still unmounts the captured identity on failure. No mount is selected, deduplicated, or adopted, and no storage cap, mount option, or trust check is relaxed. invocationAfterBind still records the inherited shared class for diagnostics.

Caveat: as with any bind beneath a shared mount, the kernel may propagate a copy to destination peers at bind time. Those copies are not adopted, and unmounts still propagate through the shared parent.

Tests

  • New unit cases cover the shared-destination flow. Successful privatization passes. Failed or ignored privatization and a remount that re-shares the mount all fail with storage-mount-propagation. The tests also check command order (--bind → --make-private → remount), journal verification order, an unchanged host table, sanitized evidence, and cleanup.
  • Existing discrimination cases now model the realistic shared bind before privatization. The noop remount-shared row moved to the new test.
  • The gated Linux integration test now expects destination-shared and shared-both to pass verification, produce a single-entry sealed snapshot, keep the destination shared, and clean up. It requires privileged Linux and did not run on macOS.
  • Validation passed: build, type-check, ESLint with 0 errors, Markdown lint, and Jest across src/cloud-hypervisor, src/enclave, and the live-smoke sanitizer (79 suites, 2,147 tests passed).

Docs

docs/cloud-hypervisor-foundation.md has a new “Private invocation state mount” section with the v0.28.44 evidence and the fix.

A new release and a release-pinned environment probe are required to confirm live startup gets past this check.

The v0.28.44 probe (run 37576714531) showed a private state source bound
beneath a shared external invocation destination producing one exact shared
invocation mount, failing storage-verification/invocation-state. All local
allocation roles stayed private.

Privatize only the captured invocation mount (non-recursive --make-private)
after re-verifying the journal and before the restrictive remount, and fail
closed unless invocationAfterRemount is one exact private entry. Host and
destination propagation are unchanged.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 05:39
@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-9536 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 17986ea

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

🟡 Changes recommended

The documented failure classification and status are inconsistent with the tests and adjacent documentation.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

This PR addresses shared propagation inherited by enclave invocation-state bind mounts.

Changes:

  • Privatizes the captured invocation mount before restrictive remounting.
  • Adds unit and privileged Linux regression coverage.
  • Documents the probe evidence and mitigation.
File Description
src/​cloud-hypervisor/​trusted-enclave-storage.ts Privatizes and verifies invocation mounts.
src/​cloud-hypervisor/​trusted-enclave-storage.test.ts Tests privatization outcomes and ordering.
src/​cloud-hypervisor/​enclave-mount-capture.integration.test.ts Updates shared-destination integration expectations.
docs/​cloud-hypervisor-foundation.md Documents evidence and remediation.

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

const mounted = storage.dependencies.mountTmpfs!(plan.invocationHostDir, profiles.script.writableStorageBytes,
profiles.script.uid, profiles.script.gid, tools);
if (outcome === 'privatized') await expect(mounted).resolves.toBeUndefined();
else if (outcome === 'privatize-denied') await expect(mounted).rejects.toBe(failure);
Comment on lines +1556 to +1557
cleanup. A new release and release-pinned environment probe are required to
establish whether live startup progresses beyond this guard.
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.00% 93.01% 📈 +0.01%
Statements 91.50% 91.51% 📈 +0.01%
Functions 90.19% 90.19% ➡️ +0.00%
Branches 85.24% 85.25% 📈 +0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/cloud-hypervisor/trusted-enclave-storage.ts 93.4% → 93.4% (+0.08%) 91.6% → 91.7% (+0.10%)
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 address review feedback

Copilot AI commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in 7356884: documented the distinction between tool/errno failures and a successful but ineffective privatization, added assertions for both failure paths, and removed the stale v0.28.43 conclusion.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox
lpcox merged commit eea3277 into main Oct 7, 2026
28 of 29 checks passed
@lpcox
lpcox deleted the fix/enclave-invocation-private branch October 7, 2026 13:46
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