Skip to content

MigTD: add retry for quote generation#754

Open
haitaohuang wants to merge 1 commit intointel:mainfrom
haitaohuang:quote_retry
Open

MigTD: add retry for quote generation#754
haitaohuang wants to merge 1 commit intointel:mainfrom
haitaohuang:quote_retry

Conversation

@haitaohuang
Copy link
Contributor

Add new quote module (src/migtd/src/quote.rs) that centralizes TD quote generation with exponential backoff retry (5s initial, up to 9 attempts). This handles the race where an impactless security update invalidates a TD REPORT generated before the update then sent for quote generation.

Replace direct attestation::get_quote + tdcall_report calls with quote::get_quote_with_retry in three call sites:

  • mig_policy.rs: local TCB info initialization
  • ratls/server_client.rs: RA-TLS quote generation
  • spdm/mod.rs: SPDM quote generation, also changed error return to MigrationAttestationError for failed quote generation, consistent with RA-TLS.

Add new quote module (src/migtd/src/quote.rs) that centralizes TD quote
generation with exponential backoff retry (5s initial, up to 9 attempts).
This handles the race where an impactless security update invalidates a TD
REPORT generated before the update then sent for quote generation.

Replace direct attestation::get_quote + tdcall_report calls with
quote::get_quote_with_retry in three call sites:
- mig_policy.rs: local TCB info initialization
- ratls/server_client.rs: RA-TLS quote generation
- spdm/mod.rs: SPDM quote generation, also changed error return to
  MigrationAttestationError for failed quote generation, consistent with
RA-TLS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
@haitaohuang haitaohuang requested a review from jyao1 as a code owner March 17, 2026 23:39
const INITIAL_DELAY_MS: u64 = 5000;

/// Maximum number of attempts before giving up
const MAX_ATTEMPTS: u32 = 9; // Total wait time up to ~21 minutes with 5s initial delay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bodzhang , please review this and ensure 21 minutes is OK.

e,
delay_ms
);
delay_milliseconds(delay_ms);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am OK with the retry.
@haitaohuang, Question on validation: Do we have test to trigger the retry flow, and ensure it works as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did test on a lab blade where getQuote fails and the mechanism worked as expected. Also had a mock test that add a forced failure on first try in my branch but took out because I did not want to mix with production code and make it harder to read. If you want, I can add back.

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