Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **TDX quotes go to QGS over vsock first.** When `/etc/tdx-attest.conf`
sets a port, `tdx-attest` asks QGS directly and falls back to configfs only
if that fails, or uses configfs alone when `DCAP_TDX_QUOTE_CONFIGFS_PATH` is
set. The kernel's configfs path polls once a second, so a quote took about
1 s there and takes about 5 ms over vsock.
- **`vmm-cli update --compose` takes an app compose file.** It sends the
`app-compose.json` written by `vmm-cli compose` unchanged instead of a Docker
Compose file patched into the stored one, and `--prelaunch-script` and
Expand Down
21 changes: 15 additions & 6 deletions dstack/tdx-attest/src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,26 @@ static CONFIGFS_MKDIR_TRIED: Mutex<bool> = Mutex::new(false);
/// Get a TDX quote for the given report data.
///
/// Tries multiple methods in order:
/// 1. ConfigFS (Linux 6.7+)
/// 2. VSock to QGS service
/// 1. VSock to QGS service, when a port is configured and no configfs path is
/// forced through the environment
/// 2. ConfigFS (Linux 6.7+)
///
/// VSock goes first because the kernel's configfs path polls for the quote
/// once a second, so a quote QGS returns in milliseconds takes a second there.
pub fn get_quote(report_data: &TdxReportData) -> Result<Vec<u8>> {
let _guard = TDX_LOCK.lock().map_err(|_| TdxAttestError::Busy)?;

if should_try_configfs() {
return get_quote_via_configfs(report_data);
if std::env::var_os(CONFIGFS_PATH_ENV).is_none() && is_vsock_available() {
match get_quote_via_vsock(report_data) {
Ok(quote) => return Ok(quote),
Err(err) if !should_try_configfs() => return Err(err),
// Images configure the port whether or not the host serves it.
Err(_) => {}
}
}

if is_vsock_available() {
return get_quote_via_vsock(report_data);
if should_try_configfs() {
return get_quote_via_configfs(report_data);
}

Err(TdxAttestError::NotSupported(
Expand Down
Loading