Skip to content

guest: add TEE ABI simulator for no-TEE development VMs#780

Open
kvinwang wants to merge 3 commits into
masterfrom
feat/dev-tdx-simulator
Open

guest: add TEE ABI simulator for no-TEE development VMs#780
kvinwang wants to merge 3 commits into
masterfrom
feat/dev-tdx-simulator

Conversation

@kvinwang

@kvinwang kvinwang commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

Developers need to boot dstack guests without real TEE hardware and still exercise the real guest setup path: prepare, key provisioning, encrypted storage, measurements, event logs, guest-agent, and quote/RTMR APIs.

PR #766 solves this by threading a no_tee flag through VMM, compose, guest setup, and guest-agent, then branching the security path when that flag is set (skip encryption, skip attestation, short-circuit key provider checks, disable quote APIs, and so on). That works for local bring-up, but it has two lasting costs:

  1. Security path complexity. Core boot and attestation logic gains many
    if no_tee special cases. Those branches are easy to get subtly wrong, hard
    to audit, and they permanently dilute the production code that reviewers and
    verifiers care about.
  2. Weak test coverage of production code. The no-TEE path deliberately
    avoids the production path. Bugs that only exist when encryption,
    measurement, quote generation, or RTMR extension run still cannot be caught
    by no-TEE development boots.

Approach in this PR

Instead of teaching guest software about “no TEE”, keep guest software on the
production path and simulate the TEE ABI under the guest.

This PR adds dstack-tee-simulator, a FUSE service packaged only into
development images:

  • default platform backend is TDX (extensible later via --platform)
  • serves a configfs-tsm quote provider under /sys/kernel/config/tsm/report
  • serves RTMR measurement files used by tdx-attest
  • serves a CCEL boot-event fixture for event-log replay
  • starts before dstack-prepare, then the existing guest stack runs unchanged
  • refuses to start when a real TDX/SEV device or provider is already present

Simulated quotes parse for guest integration work but carry an intentionally
invalid signature, so production verifiers and KMS reject them.

Why this replaces #766

#766 (no_tee branches) This PR (ABI simulator)
Guest security path Many if no_tee checks in prepare, key setup, encryption, attestation, guest-agent Unchanged production path
What no-TEE boots exercise A reduced “dev mode” subset Nearly the full production guest path
Audit surface Permanent dual-mode logic in security-critical code Simulator is isolated; production code stays single-path
Storage / keys / quotes Encryption off; attestation APIs rejected; temporary keys Same setup flow as TEE guests; quotes/RTMRs/event logs still run
Failure mode if misused Relies on host/VMM policy plus many guest checks Dev-image-only package + invalid quote signatures + start guards against real TEE

The point is not that #766 is unusable for local testing. It is that the cost of
that design sits on the wrong side of the boundary: it complicates the code we
ship and audit, and it stops development VMs from covering the path we most need
to keep correct.

Safety

  • Installed only via dstack-rootfs-dev.inc (development images).
  • Service does not start when /dev/tdx_guest, /dev/sev-guest, or a real
    tdx_guest* / sev_guest* TSM provider is present.
  • Simulated quotes have invalid signatures and must be rejected by production
    verifiers/KMS.
  • This mode provides no hardware isolation and must not be used with
    production workloads or secrets.

Validation

cargo test -p dstack-tee-simulator

Previous local validation on this series also included a dstack-dev image
build and a no_tee KVM boot where prepare, temporary app keys, LUKS/ZFS setup,
guest-agent, quote generation, event-log read, and RTMR extend all succeeded on
the production guest path.

Docs

Maintainer workflow is documented in CONTRIBUTING.md.

Copilot AI review requested due to automatic review settings July 15, 2026 16:35

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.

Pull request overview

This PR enables no_tee development VMs to exercise the same TDX-oriented guest setup, measurement, event log, and attestation code paths as production by introducing a development-image-only TDX/TSM ABI simulator and improving TDX detection.

Changes:

  • Add a FUSE-based dstack-tdx-simulator that serves a simulated configfs TSM provider, RTMR measurement files, and a CCEL fixture (dev images only).
  • Improve TDX detection to recognize configfs TSM tdx_guest* providers (not only /dev/tdx_guest) and add env overrides for simulator wiring.
  • Enforce that no_tee=true is only allowed with development images and document the workflow.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
os/yocto/layers/meta-dstack/recipes-core/images/dstack-rootfs-dev.inc Adds dstack-tdx-simulator to the dev rootfs image package set.
os/yocto/layers/meta-dstack/recipes-core/dstack-tdx-simulator/dstack-tdx-simulator.bb New Yocto recipe to build/install the simulator binary, unit, and prepare ordering drop-in.
os/common/rootfs/dstack-tdx-simulator.service New systemd service to start the simulator ahead of guest preparation and set env overrides.
os/common/rootfs/dstack-prepare.sh Extends guest-side TEE detection to include configfs TSM provider probing.
os/common/rootfs/dstack-prepare.service.d/tdx-simulator.conf Ensures dstack-prepare requires/starts after the simulator on dev images.
dstack/vmm/src/one_shot.rs Validates no_tee is only permitted with dev images in one-shot mode.
dstack/vmm/src/app.rs Adds validate_tee_image_mode() and applies it to VM create/reload paths; includes a unit test.
dstack/tdx-simulator/src/main.rs New FUSE implementation of a simulated TSM report tree with quote + RTMR behaviors and tests.
dstack/tdx-simulator/Cargo.toml New crate definition for dstack-tdx-simulator.
dstack/tdx-attest/src/linux.rs Adds is_tdx_available() (device or provider), configfs provider scanning, RTMR sysfs env override, and tests.
dstack/tdx-attest/src/dummy.rs Adds dummy is_tdx_available() for non-Linux/non-x86_64 targets.
dstack/tdx-attest/Cargo.toml Adds tempfile for new configfs-provider tests.
dstack/dstack-attest/src/attestation.rs Switches TDX presence detection to tdx_attest::is_tdx_available().
dstack/cc-eventlog/src/tdx.rs Exposes decode_ccel() helper (used by simulator) and adds a test for bundled CCEL.
dstack/cc-eventlog/src/tcg.rs Adds DSTACK_CCEL_FILE env override for CCEL reading (simulator integration).
dstack/Cargo.toml Adds tdx-simulator workspace member and the fuser workspace dependency.
dstack/Cargo.lock Locks new crate and dependency additions (fuser, page_size, tempfile, etc.).
CONTRIBUTING.md Documents the dev --no-tee workflow and simulator semantics/safety expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dstack/tdx-attest/src/linux.rs Outdated
Comment thread os/common/rootfs/dstack-tdx-simulator.service Outdated
@kvinwang kvinwang changed the title guest: simulate TDX ABI for no-TEE dev VMs guest: add extensible TEE simulator for no-TEE dev VMs Jul 16, 2026
@kvinwang kvinwang force-pushed the feat/dev-tdx-simulator branch from 5488897 to 4a4dfa0 Compare July 16, 2026 02:26
@kvinwang kvinwang changed the base branch from master to feat/tsm-provider-env-support July 16, 2026 02:26
@kvinwang kvinwang changed the title guest: add extensible TEE simulator for no-TEE dev VMs feat(os): add extensible dstack-tee-simulator for no-TEE dev VMs Jul 16, 2026
@kvinwang kvinwang force-pushed the feat/dev-tdx-simulator branch 2 times, most recently from 39b07f8 to 40335d7 Compare July 16, 2026 02:38
@kvinwang kvinwang changed the base branch from feat/tsm-provider-env-support to master July 16, 2026 02:38
@kvinwang kvinwang changed the title feat(os): add extensible dstack-tee-simulator for no-TEE dev VMs guest: add TEE ABI simulator for no-TEE development VMs Jul 16, 2026
kvinwang added 2 commits July 15, 2026 20:50
Add a FUSE-based TEE simulator (default TDX backend) that exposes the
configfs-tsm quote, RTMR, and CCEL interfaces used by the existing guest
path. Packaged only into development images.
Use provider value tdx_guest like the kernel TSM interface, and keep the
systemd unit plus prepare drop-in under the Yocto recipe files/ tree
instead of os/common/rootfs.
@kvinwang kvinwang force-pushed the feat/dev-tdx-simulator branch from 33a4988 to 006b210 Compare July 16, 2026 03:51
After the SDK workspace split, dstack-tee-simulator only builds from the
core workspace, so staging sdk/rust is unnecessary (same as dstack-guest).
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