Skip to content

Drop two-phase rebind from AzCVMEmu tooling - #1102

Draft
sgrams wants to merge 1 commit into
intel:mainfrom
sgrams:fix/cvmemu-single-phase-rebind
Draft

sgrams wants to merge 1 commit into
intel:mainfrom
sgrams:fix/cvmemu-single-phase-rebind

Conversation

@sgrams

@sgrams sgrams commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Commit 433dd79 removed the PREPARE/FINALIZE rebind model from the firmware per GHCI 1.5, but the AzCVMEmu emulator, CLI, runner script, and CI matrix still carried it. This PR brings the emulation tooling in line with the single-phase model.

Problem

The emulator wrote the rebind operation byte at payload offset 10. The firmware now treats bytes 10..16 as reserved and MigtdMigrationInformation::read_from_bytes rejects any non-zero value with InvalidParameter, so:

  • --operation rebind-finalize (op = 1) always failed before any rebind logic ran.
  • --operation rebind-prepare (op = 0) only worked because a zero op byte is indistinguishable from zeroed reserved bytes.

migtdemu.sh also still claimed that rebind-finalize "clears the session token", describing behaviour that no longer exists.

Changes

  • deps/td-shim-AzCVMEmu/tdx-tdcall/src/tdx_emu.rs: drop operation from EmuMigRequest::StartRebinding and set_emulated_start_rebinding; zero bytes 10..16 as reserved and update the layout comment.
  • src/migtd/src/bin/migtd/cvmemu.rs: replace rebind-prepare / rebind-finalize with a single rebind operation (--operation rebind / -o rb); one dispatch arm; updated usage text.
  • migtdemu.sh: accept only migration or rebind; help text describes the single-phase handshake (TLS/SPDM session, token exchange, approval).
  • .github/workflows/integration-emu.yml: rename the three rebind matrix entries and switch them to --operation rebind.

No backward-compatibility aliases are kept for the old operation names.

Verification

  • cargo check --bin migtd --no-default-features --features AzCVMEmu,policy_v2,test_mock_report
  • same with spdm_attestation (SPDM_CONFIG=config/spdm_config.json)
  • rustfmt --check on touched files; bash -n migtdemu.sh; shellcheck shows no new warnings; workflow YAML parses
  • integration-emu CI covers the renamed Rebind (Skip RA), Rebind (Mock Report), and SPDM Rebind (Skip RA) jobs end to end

Commit 433dd79 removed the PREPARE/FINALIZE rebind model from the
firmware per GHCI 1.5, but the AzCVMEmu emulator, CLI, runner script,
and CI matrix still carried it. The emulator wrote the operation byte at
payload offset 10, which the firmware now treats as reserved and
rejects when non-zero, so `--operation rebind-finalize` always failed
with InvalidParameter and `rebind-prepare` only worked by accident.

Remove the operation field from the emulated StartRebinding request and
zero bytes 10..16 as reserved. Replace the two CLI operations with a
single `rebind` operation in the emulator binary and migtdemu.sh,
update the help text to describe the single-phase handshake, and point
the integration-emu workflow at the new operation name.

Assisted-by: GitHub Copilot:Claude Opus 4.6
Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
@sgrams
sgrams force-pushed the fix/cvmemu-single-phase-rebind branch from 27bc97d to 8e70539 Compare October 27, 2026 08:43
@sgrams sgrams closed this Oct 27, 2026
@sgrams sgrams reopened this Oct 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.

1 participant