Skip to content

Commit aca96b6

Browse files
authored
feat(tdx-attest): Rewrite TDX attestation in pure Rust (#466)
* feat(tdx-attest): Add MUSL libc support for TDX attestation Enable building with x86_64-unknown-linux-musl target by: 1. Vendoring minimal Linux kernel headers that are missing from MUSL: - linux/vm_sockets.h: vsock address family and sockaddr_vm struct - linux/types.h: kernel type aliases (__u8, __u32, __u64, etc.) - linux/ioctl.h: redirect to MUSL's sys/ioctl.h 2. Updating cfg conditions to include MUSL (target_env = "musl") alongside glibc (target_env = "gnu") 3. Modifying build.rs to prioritize vendored headers via include path This allows building statically-linked TDX attestation binaries using MUSL, which is useful for containerized deployments and systems without glibc. Tested: cargo build --target x86_64-unknown-linux-musl -p tdx-attest * feat(tdx-attest): Rewrite TDX attestation in pure Rust Implement TDX attestation without C library dependencies: - get_quote: ConfigFS (Linux 6.7+) → VSock/QGS fallback - extend_rtmr: sysfs → ioctl fallback - get_report: ioctl via /dev/tdx_guest - get_supported_att_key_ids: returns Intel TDQE UUID Key changes: - Add vsock crate for QGS protocol communication - Probe availability before execution (separate NotSupported from errors) - Include original error context in error messages - Support both new dstack OS (ConfigFS/sysfs) and legacy 0.5.4 (VSock/ioctl) Tested on: - New dstack OS: ConfigFS for quote, sysfs for extend_rtmr - dstack 0.5.4: VSock for quote, ioctl for extend_rtmr
1 parent 4c6cf88 commit aca96b6

21 files changed

Lines changed: 721 additions & 3542 deletions

CLAUDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ RPC definitions use `prpc` framework with Protocol Buffers:
210210

211211
### Working with TDX Quotes
212212

213-
- Low-level bindings: `tdx-attest-sys/` (FFI to libtdx-attest)
214-
- High-level API: `tdx-attest/`
213+
- Pure Rust API: `tdx-attest/`
215214
- Verification: `verifier/` using `dcap-qvl`
216215
- Event log parsing: `cc-eventlog/`
217216

Cargo.lock

Lines changed: 4 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ members = [
1818
"kms/rpc",
1919
"ra-rpc",
2020
"ra-tls",
21-
"tdx-attest-sys",
2221
"tdx-attest",
2322
"dstack-attest",
2423
"dstack-util",
@@ -69,7 +68,6 @@ cc-eventlog = { path = "cc-eventlog" }
6968
supervisor = { path = "supervisor" }
7069
supervisor-client = { path = "supervisor/client" }
7170
tdx-attest = { path = "tdx-attest" }
72-
tdx-attest-sys = { path = "tdx-attest-sys" }
7371
dstack-attest = { path = "dstack-attest" }
7472
certbot = { path = "certbot" }
7573
rocket-vsock-listener = { path = "rocket-vsock-listener" }

LICENSES/BSD-3-Clause.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

REUSE.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ SPDX-FileCopyrightText = "NONE"
115115
SPDX-License-Identifier = "Apache-2.0"
116116
precedence = "override"
117117

118-
[[annotations]]
119-
path = "tdx-attest-sys/csrc/*"
120-
SPDX-FileCopyrightText = "Copyright (C) 2011-2021 Intel Corporation. All rights reserved."
121-
SPDX-License-Identifier = "BSD-3-Clause"
122-
123118
[[annotations]]
124119
path = "mod-tdx-guest/Kconfig"
125120
SPDX-FileCopyrightText = "© 2022 Intel Corporation"

0 commit comments

Comments
 (0)