Commit aca96b6
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_rtmr1 parent 4c6cf88 commit aca96b6
21 files changed
Lines changed: 721 additions & 3542 deletions
File tree
- LICENSES
- tdx-attest-sys
- csrc
- src
- tdx-attest
- examples
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
| 213 | + | |
215 | 214 | | |
216 | 215 | | |
217 | 216 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
| |||
0 commit comments