Repository navigation
fix(guest-agent): avoid TDX Info quotes and bound attestation waits - #1659
Open
kingsleydon wants to merge 3 commits into
Open
kingsleydon wants to merge 3 commits into
kingsleydon wants to merge 3 commits into
Conversation
Legacy Info minted a full TDX quote just to read MRTD, the RTMRs, and the event log. Rocket kept running handlers after clients disconnected. With an unbounded FIFO, abandoned requests consumed quote capacity until live callers timed out too. Read TDREPORT measurements and the event log for TDX Info outside the quote queue. Bound attestation waits and return retryable HTTP 503 when a wait expires. The 15-second default absorbs roughly 15 one-second quotes while leaving time within AntSeed's 20-second deadline and the proposed 20-second pig-tail deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kingsley <10992364+kingsleydon@users.noreply.github.com>
kingsleydon
force-pushed
the
fix/guest-agent-info-quote-backlog
branch
from
November 27, 2026 06:35
85a2911 to
58679d8
Compare
Read MRTD and RTMR0-3 for legacy Info from the kernel's TSM measurement sysfs (tdx_guest/measurements) instead of parsing TDREPORT offsets. The kernel already decodes the report there, and the directory's presence is enough to pick the local path, so the startup TEE probe and the TDREPORT helpers are gone. Kernels without the interface fall back to the attestation path as before. On a dstack 0.6.5 CVM the sysfs values match the quote's and a read takes about 0.1 ms, also while a configfs quote is in flight. Bound the attestation queue wait with a constant 10-second timeout in attest() only, matching the gateway's legacy Info timeout. A timed-out wait returns HTTP 503 as an ordinary error, so the existing identity and demo-cert throttles treat it like any other failure: congestion backs off too. With the bound and the throttle in place every identity caller waits at most one timeout, so identity() keeps its OnceCell and needs no deadline of its own. This drops the attest_queue_timeout_secs option, attest_until, the AttestationQueueBusy type, the OnceLock/tokio::Mutex identity rewrite, the demo-cert special case, and the unrelated message and comment edits. Signed-off-by: Kevin Wang <wy721@qq.com>
Collaborator
|
The root cause of the backlog is that quotes go through the kernel's configfs path, which polls once a second, so each quote takes about 1 s although QGS answers in about 5 ms. #1660 switches |
The TEE simulator sets DCAP_TDX_RTMR_SYSFS_PATH to its own measurements directory, which has rtmr0-3 but no mrtd. Following that override made read_measurements() fail there, so legacy Info errored in the TDX simulator, and in the SEV-SNP and Nitro simulators, where the directory does not exist at all. Read only the kernel's tdx_guest/measurements path. Simulated guests do not have it and fall back to reading the measurements from a quote, as before. Signed-off-by: Kevin Wang <wy721@qq.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Legacy
Infocalledattestation_for_info, which calledAttestation::local()and generated a full quote just to read MRTD, RTMR0–3, and the event log.get_info·attestation_for_info·Attestation::localAppStateInner::attestwaited on an unbounded FIFO. Rocket kept running handlers after clients disconnected, so expired requests consumed quote capacity while live callers timed out behind them. Serial logs from two production TDX CVMs running dstack 0.6.5 showed roughly 2,600–2,950Broken pipemessages per hour and node quote requests timed out. The backlog returned within minutes of a restart.AppStateInner::attestChange
/dev/tdx_guest, legacyInforeads TDREPORT and the event log outside the quote queue. Startup detection keeps the SEV-SNP configfs probe off the request path.attest_queue_timeout_secs, which defaults to 15 seconds. An expired waiter leaves the queue and gets retryable HTTP 503. Each caller with an uncached identity uses the same deadline for identity initialization and quote admission.Why 15 seconds
A 15-second wait accommodates roughly 15 queued one-second TDX quotes and leaves room for quote execution within the AntSeed prover's 20-second deadline and pig-tail's proposed 20-second per-RPC deadline. The TDX
tcb_infopath bypasses the quote queue. pig-tail PR #3Compatibility
The
tcb_infoJSON fields, event log contents, and event ordering are identical. Non-TDX and configfs-only guests continue to use the existing attestation-backedInfopath. With the default, those requests can wait up to 15 seconds for a quote slot, which exceeds the gateway's 10-second legacyInfotimeout. Quotes on those paths are generally fast, though the gateway can time out first if the queue stays busy. Gateway legacyInfotimeoutTests
cargo test --locked -j 6 -p dstack-guest-agent -p dstack-guest-agent-simulator -p tdx-attest --all-featurespassed all 181 tests. The regressions cover the legacy TCB JSON during a held quote, expired and cancelled waiters, FIFO order, and concurrent identity callers receiving 503 within one wait bound.cargo clippy --locked -j 6 -p dstack-guest-agent -p dstack-guest-agent-simulator -p tdx-attest -- -D warnings -D clippy::expect_used -D clippy::unwrap_used --allow unused_variablespassed with the Rust workflow flags.cargo fmt --check --all,reuse lint, andgit diff origin/next...HEAD --checkpassed.Not verified
Quote timing and concurrent TDREPORT and configfs or vsock quote generation on real TDX hardware.
🤖 Generated with Claude Code