Skip to content

fix(servtd_ext): gate per-binding fields on TDX_FEATURES0.SERVTD_REBIND#856

Open
sgrams wants to merge 1 commit into
intel:mainfrom
sgrams:fix/rebind_gate
Open

fix(servtd_ext): gate per-binding fields on TDX_FEATURES0.SERVTD_REBIND#856
sgrams wants to merge 1 commit into
intel:mainfrom
sgrams:fix/rebind_gate

Conversation

@sgrams
Copy link
Copy Markdown
Contributor

@sgrams sgrams commented May 27, 2026

The per-binding SERVICE_TD class metadata fields (SERVTD_ATTR, SERVTD_INFO_HASH, INIT_ATTR, etc.) are only available when the TDX module supports the SERVTD_REBIND feature (BIT48 of TDX_FEATURES0).

Add is_rebind_supported() that reads TDX_FEATURES0 via TDG.SYS.RD and checks BIT48. Gate verify_servtd_attr, read_servtd_ext, and write_approved_servtd_ext_hash on this check:

  • If BIT48 is NOT set: skip gracefully (fields unavailable)
  • If BIT48 IS set: enforce strictly (fail on errors)

Update callers in spdm_req.rs (sends zeroed struct when unavailable) and rebinding.rs (fails with Unsupported since rebinding requires BIT48).

The per-binding SERVICE_TD class metadata fields (SERVTD_ATTR,
SERVTD_INFO_HASH, INIT_ATTR, etc.) are only available when the TDX
module supports the SERVTD_REBIND feature (BIT48 of TDX_FEATURES0).

Add is_rebind_supported() that reads TDX_FEATURES0 via TDG.SYS.RD and
checks BIT48. Gate verify_servtd_attr, read_servtd_ext, and
write_approved_servtd_ext_hash on this check:

- If BIT48 is NOT set: skip gracefully (fields unavailable)
- If BIT48 IS set: enforce strictly (fail on errors)

Update callers in spdm_req.rs (sends zeroed struct when unavailable)
and rebinding.rs (fails with Unsupported since rebinding requires
BIT48).

Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
@sgrams sgrams requested a review from jyao1 as a code owner May 27, 2026 13:01
Comment on lines +58 to +61
log::warn!(
"Failed to read TDX_FEATURES0: {:?}, assuming rebind not supported",
e
);
Comment on lines +209 to +213
log::error!(
"TDG.SERVTD.RD(SERVTD_ATTR) failed: {:?}, binding_handle={binding_handle:#x}, field_id={:#x}",
e,
TDCS_FIELD_SERVTD_ATTR
);
@sgrams sgrams closed this May 27, 2026
@sgrams sgrams reopened this May 27, 2026
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