Skip to content

rebinding: populate UTF-8 reason string on SPDM error paths#884

Merged
sgrams merged 1 commit into
intel:mainfrom
sgrams:t3-spdm-rebind-reason-strings
Jun 10, 2026
Merged

rebinding: populate UTF-8 reason string on SPDM error paths#884
sgrams merged 1 commit into
intel:mainfrom
sgrams:t3-spdm-rebind-reason-strings

Conversation

@sgrams

@sgrams sgrams commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The non-SPDM rebinding_old_prepare / rebinding_new_prepare populate the VMM ReportStatus reason buffer (data: &mut Vec<u8>) on transport failures, gated by #[cfg(feature = "vmcall-raw")]. The SPDM-featured counterparts had the parameter spelled _data and never wrote to it, so GHCI 1.5 ReportStatus (p. 47–48, Tables 3-55/3-56) carried no diagnostic payload when an SPDM rebind failed.

Change

Mirror the non-SPDM pattern at the three SPDM error sites in both rebinding_old_prepare and rebinding_new_prepare:

  • spdm_requester / spdm_responder transport setup failure
  • with_timeout timeout around spdm_requester_rebind_old / spdm_responder_rebind_new
  • the SPDM rebind operation itself

Each .map_err closure now pushes a one-line UTF-8 reason string (operation name, MigrationResult variant, migration ID in hex) into data, gated by #[cfg(feature = "vmcall-raw")] to match the non-SPDM RA-TLS arms. log::error! calls are preserved verbatim.

No behavior change with vmcall-raw off — data is unused, same warning the existing non-SPDM functions already emit on that configuration.

Test

cargo check -p migtd --no-default-features \
  --features main,stack-guard,spdm_attestation,virtio-vsock,policy_v2,test_disable_ra_and_accept_all \
  --target x86_64-unknown-none
cargo check -p migtd --no-default-features \
  --features main,stack-guard,virtio-vsock,policy_v2,test_disable_ra_and_accept_all \
  --target x86_64-unknown-none

Both clean. The vmcall-raw + spdm_attestation build has 3 pre-existing errors on main (mig_socket_info field, setup_transport arity) that are out of scope for this PR.

Reference

GHCI 1.5 April 2026: Tables 3-55 / 3-56 — ReportStatus data buffer carries a UTF-8 reason string describing why a migration/rebind failed.

@sgrams sgrams requested a review from jyao1 as a code owner June 8, 2026 13:27
@sgrams sgrams marked this pull request as draft June 8, 2026 13:45
@sgrams sgrams changed the title rebinding: populate UTF-8 reason string on SPDM error paths DRAFT: rebinding: populate UTF-8 reason string on SPDM error paths Jun 8, 2026
The non-SPDM rebinding_old_prepare / rebinding_new_prepare populate the
VMM ReportStatus reason buffer (data: &mut Vec<u8>) on transport
failures, gated by #[cfg(feature = "vmcall-raw")]. The SPDM-featured
counterparts had the parameter spelled _data and never wrote to it, so
GHCI 1.5 ReportStatus (p. 47-48, Tables 3-55/3-56) had no diagnostic
payload when an SPDM rebind failed.

Mirror the non-SPDM pattern at the three SPDM error sites:

  * spdm_requester / spdm_responder transport setup failure
  * with_timeout timeout error around spdm_requester_rebind_old /
    spdm_responder_rebind_new
  * the SPDM rebind operation itself

Each .map_err closure now pushes a one-line UTF-8 reason string
(operation name, MigrationResult variant, migration ID in hex) into
data, gated by #[cfg(feature = "vmcall-raw")] to match the non-SPDM
RA-TLS arms. log::error! calls are preserved verbatim.

No behavior change with vmcall-raw off: data is unused (same warning as
the existing non-SPDM functions on that configuration).

Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
@sgrams sgrams force-pushed the t3-spdm-rebind-reason-strings branch from 0aade43 to 8eb71fe Compare June 9, 2026 08:33
@sgrams sgrams changed the title DRAFT: rebinding: populate UTF-8 reason string on SPDM error paths rebinding: populate UTF-8 reason string on SPDM error paths Jun 9, 2026
@sgrams sgrams marked this pull request as ready for review June 9, 2026 16:15
@sgrams sgrams requested a review from MichalTarnacki June 9, 2026 16:25
@sgrams sgrams self-assigned this Jun 9, 2026
@haitaohuang

Copy link
Copy Markdown
Contributor

LGTM

@sgrams sgrams merged commit f75347a into intel:main Jun 10, 2026
56 checks passed
@sgrams sgrams deleted the t3-spdm-rebind-reason-strings branch June 10, 2026 07:45
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.

3 participants