Skip to content

Merge intel changes#181

Merged
haitaohuang merged 21 commits into
microsoft:mainfrom
haitaohuang:merge_intel
May 22, 2026
Merged

Merge intel changes#181
haitaohuang merged 21 commits into
microsoft:mainfrom
haitaohuang:merge_intel

Conversation

@haitaohuang
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/migtd/src/migration/mod.rs Fixed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR merges updates around GHCI 1.5 MigTD/rebinding data handling, SERVTD attribute validation, attestation reliability, DMA read bounds, and dependency/workflow refreshes.

Changes:

  • Reworks init MigTD data handling to use raw TDINFO bytes and removes init event log propagation in rebind/RATLS/SPDM paths.
  • Adds policy/SERVTD binding checks, crash-report error codes, attestation/logging adjustments, and safer DMA length handling.
  • Refreshes selected dependencies, container base image, and pinned GitHub Actions.

Reviewed changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/policy/src/v2/policy.rs Adds policy SVN accessor.
src/migtd/src/spdm/spdm_vdm.rs Updates rebind attest element count.
src/migtd/src/spdm/spdm_rsp.rs Adjusts rebind info type, removes init event log parsing, adds SERVTD attr verification.
src/migtd/src/spdm/spdm_req.rs Sends raw TDINFO for migration/rebinding and removes init event log element.
src/migtd/src/spdm/spdm_rebind.rs Uses MigtdMigrationInformation for rebind SPDM flows.
src/migtd/src/ratls/server_client.rs Removes init event log extension/verification in rebinding certificates.
src/migtd/src/migration/session.rs Parses unified migration info, returns raw TDINFO for GetMigtdData, adds binding checks.
src/migtd/src/migration/servtd_ext.rs Adds SERVTD attr validation helper and stricter read validation.
src/migtd/src/migration/rebinding.rs Removes custom rebind/init data structs and uses raw TDINFO from migration info.
src/migtd/src/migration/mod.rs Adds TDINFO helpers, extends migration info layout, and adds initialization result code.
src/migtd/src/migration/event.rs Uses initialization result code for callback registration failure.
src/migtd/src/migration/data.rs Updates rebind response type and migration info field initialization.
src/migtd/src/mig_policy.rs Generates local TCB info on demand and adds TDINFO policy binding checks.
src/migtd/src/driver/vmcall_raw.rs Marks crash-report panic helper as diverging.
src/migtd/src/driver/timer.rs Reports initialization failures through crash-report helper.
src/migtd/src/bin/migtd/main.rs Converts startup panics to crash reports and verifies own TDINFO policy binding.
src/migtd/src/bin/migtd/cvmemu.rs Uses crash-report helper and renames rebind source variable.
src/devices/vsock/src/transport/virtio_pci.rs Bounds DMA data reads by tracked allocation size.
src/devices/vmcall_raw/src/transport/vmcall.rs Clarifies send completion length and rejects zero-length receive success.
src/devices/virtio_serial/src/lib.rs Bounds virtio-serial DMA reads by tracked allocation size.
src/crypto/src/lib.rs Adds policy signer public-key hash helper.
src/attestation/src/igvmattest.rs Reduces quote debug logging volume.
src/attestation/src/binding.rs Changes attestation FFI return types to i32.
src/attestation/src/attest.rs Updates attestation result handling and increases private heap size.
deps/td-shim-AzCVMEmu/azcvm-extract-report/Cargo.lock Updates Tokio lockfile entry.
container/Dockerfile Updates Ubuntu base image.
Cargo.lock Updates selected Rust dependencies.
.github/workflows/weekly-collateral-update.yml Updates harden-runner pin.
.github/workflows/weekly-cargo-update.yml Updates harden-runner pin.
.github/workflows/trivy.yml Updates harden-runner and upload-sarif pins.
.github/workflows/scorecard.yml Updates harden-runner and upload-sarif pins.
.github/workflows/oss-fuzz.yml Updates harden-runner and upload-sarif pins.
.github/workflows/main.yml Updates harden-runner pin.
.github/workflows/library.yml Updates harden-runner pin.
.github/workflows/integration-tdx.yml Updates harden-runner pins.
.github/workflows/integration-emu.yml Updates harden-runner pin.
.github/workflows/fuzz.yml Updates harden-runner pin.
.github/workflows/format.yml Updates harden-runner and upload-sarif pins.
.github/workflows/dependency-review.yml Updates harden-runner and dependency-review action pins.
.github/workflows/deny.yml Updates harden-runner and cargo-deny action pins.
.github/workflows/codeql.yml Updates harden-runner and CodeQL action pins.
Comments suppressed due to low confidence (1)

src/migtd/src/migration/rebinding.rs:243

  • This uses VMM-provided init_td_info for rebinding without applying the policy-binding check added for normal migration (verify_init_migtd_data_policy_binding). That means a rebinding flow can proceed with an initial TDINFO whose MROWNER/MROWNERCONFIG do not match the local policy signer/SVN, even though the migration path rejects that input before exchanging keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/devices/vsock/src/transport/virtio_pci.rs
Comment thread src/devices/virtio_serial/src/lib.rs
Comment thread src/migtd/src/mig_policy.rs
Comment thread src/migtd/src/spdm/spdm_req.rs Outdated
Comment thread src/migtd/src/migration/rebinding.rs Outdated
MichalTarnacki and others added 21 commits May 22, 2026 19:25
The C library libservtd_attest.a uses servtd_attest_error_t values
(e.g. SERVTD_ATTEST_ERROR_QUOTE_FAILURE = 0x0070), but the Rust FFI
declarations used the AttestLibError enum whose discriminants match
the internal TDX_ATTEST_ERROR_* range (e.g. QuoteFailure = 0x0008).

When the C code returned a value outside the Rust enum's discriminant
set, this created an invalid enum value — undefined behavior in Rust.
In Release builds the UB was silent, but in Debug builds (Rust 1.88
with ub_checks enabled) it triggered a panic:

  "unsafe precondition(s) violated: hint::unreachable_unchecked
   must never be reached"

Fix by changing FFI return types from AttestLibError to i32 and
comparing against 0 (success) instead of AttestLibError::Success.
This matches the C API contract where 0 means success and any
non-zero value is an error code. Error codes are now logged in hex
for easier cross-reference with the C header.

Affected functions: get_quote, verify_quote_integrity,
verify_quote_integrity_ex, init_heap.

Signed-off-by: Michał Tarnacki <michal.tarnacki@intel.com>
Also replaced hard-coded 0xFF error code with proper MigrationResult variants

Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Clamp VMM-controlled descriptor len values to the known DMA allocation
size before passing them to slice_from_raw_parts/from_raw_parts. This
prevents out-of-bounds reads when a malicious VMM overwrites the shared
DMA descriptor table with inflated length values.

Vsock driver (src/devices/vsock/src/transport/virtio_pci.rs):
- pkt[1].len is now clamped to dma_record.dma_size in the receive path
- Changed contains_key to get to retrieve the DMA record for size validation

VirtIO serial driver (src/devices/virtio_serial/src/lib.rs):
- Control path: Added DMA address validation via dma_allocation.get()
  (previously missing) and clamped vq_buf.len to record.dma_size
- Data path: Changed contains_key to get, clamped buffer.len to
  record.dma_size, and clamped the downstream used_len to safe_len to
  prevent a secondary OOB on the slice index

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Currently, migtd requests a quote and cache a static tcb during MigTD
startup. This adds extra latency for migtd to start and the cached tcb
would become invalid after an impactless update for FW.

The only benefit of doing it is to verify the policy and fails fast if
the policy is malformed. That can be done by build pipelines offline.

Remove the LOCAL_TCB_INFO static cache and init_tcb_info() function.
get_local_tcb_evaluation_info() now generates a fresh quote and computes
evaluation data on every call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.52.1 to 1.52.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.52.1...tokio-1.52.2)

---
updated-dependencies:
- dependency-name: tokio
  dependency-version: 1.52.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps ubuntu from 24.04 to 26.04.

---
updated-dependencies:
- dependency-name: ubuntu
  dependency-version: '26.04'
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Add a use-mock-quote build feature that lets MigTD run on a real TDX
platform but bypass the GetQuote vmcall path to the host, returning a
canned mock quote instead. This is useful for testing and development
when the host infrastructure does not yet fully support real quote
generation.

Code changes:
- attestation: add use-mock-quote feature with mock TD report and quote
  generation, mutually exclusive with igvm-attest (compile_error guard)
- attestation/tdreport: new wrapper module that overrides tdcall_report()
  to return a mock TdxReport when use-mock-quote is enabled, and
  re-exports the rest of tdx-tdcall's tdreport API unchanged
- migtd: add use-mock-quote Cargo feature plumbing through to attestation
- event_log: bypass RTMR verification in use-mock-quote mode (mock quote
  cannot match the live event log)
- ratls: bypass public-key-hash check in TD report under use-mock-quote
- spdm: add use-mock-quote cfg guards in verify_report_data_binding and
  in v1/v2 peer attestation REPORTDATA binding checks

Build and test infrastructure:
- Azure/Makefile: add build-igvm-mock-quote and
  build-igvm-mock-quote-allow-all build targets and supporting
  generate-policy-mock-quote* recipes
- build_azure_mock_test.sh: end-to-end policy generation from mock data
  with auto-generated default templates when not present

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
… and rand packages

This commit updates openssl and rand packages to resolve dependabot
alerts

Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.52.2 to 1.52.3.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.52.2...tokio-1.52.3)

---
updated-dependencies:
- dependency-name: tokio
  dependency-version: 1.52.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.2 to 4.35.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@95e58e9...68bde55)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.19.0 to 2.19.1.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](step-security/harden-runner@8d3c67d...a5ad31d)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.19.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Per GHCI 1.5, MIGTD_DATA only contains tdinfo (type 0) and there
is no init_event_log entry. The EventLogInit VDM element was
sending the local event log as a substitute, which would fail
verification against init tdinfo RTMRs since they belong to a
different TD instance.

Remove EventLogInit from the VDM ExchangeRebindAttestInfo
request/response, drop the init_event_log parameter from
authenticate_rebinding_old(), and remove the corresponding
X.509 extension from the RATLS certificate. The rebind attest
request element count is reduced from 7 to 6.

Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
Add verify_servtd_attr() that reads CURR_SERVTD_ATTR via
TDG.SERVTD.RD and compares it against the hardcoded
EXPECTED_SERVTD_ATTR value. Call it on the SPDM responder
(destination) path before set_mig_version/write_msk, and in
the non-SPDM exchange_msk path for both source and destination.

Per GHCI 1.5, both source and destination MigTDs must verify
CURR_SERVTD_ATTR matches the expected value before any
TDG.SERVTD.WR operations (mig_dec_key, mig_version), since
the field is written by untrusted VMM during PREBIND.

Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
Per GHCI 1.5, the VMM must put migpolicy.policy_key and
migpolicy.policy_svn in TDINFO.MROWNER and TDINFO.MROWNERCONFIG
respectively, and may provide initMigtdData in the StartMigration
request for subsequent migrations.

This change implements:

a) Allow VMM to pass initMigtdData via the StartMigration request.
   MigtdMigrationInformation now has has_init_data field at offset 9
   and the parser accepts variable-length payload with init data.

b) MigTD startup self-check: verify that own TDINFO.MROWNER equals
   SHA384(policy signing public key) and TDINFO.MROWNERCONFIG equals
   own policy_svn. Reject with InvalidPolicyError on mismatch.

c) Migration flow verification: when VMM provides initMigtdData,
   verify that initMigtdData.MROWNER matches own policy signer key
   hash and initMigtdData.MROWNERCONFIG <= own policy_svn before
   proceeding with key exchange.

d) SPDM requester for migration uses VMM-provided initMigtdData
   (when available) instead of always generating local TDINFO,
   enabling correct attestation for non-initial migrations.

Closes: intel#822

Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
Per GHCI 1.5, CURR_SERVTD_ATTR must match the SERVTD_ATTR value
provided in MigTDData's TDINFO during migrate or rebind operations.

Previously, both verify_servtd_attr() and read_servtd_ext() only
compared against the hardcoded EXPECTED_SERVTD_ATTR constant (0).
While all bits are currently fixed-0, this will break if IGNORE flags
(bits 40:32) or future attribute bits become non-zero.

Add a dynamic check that also compares CURR_SERVTD_ATTR against
INIT_ATTR (read via TDCS_FIELD_SERVTD_INIT_ATTR) to ensure
forward-compatibility with non-zero SERVTD_ATTR values.

Closes: intel#831
Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.19.1 to 2.19.2.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](step-security/harden-runner@a5ad31d...9ca718d)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.9.0 to 5.0.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](actions/dependency-review-action@2031cfc...a1d282b)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [EmbarkStudios/cargo-deny-action](https://github.com/embarkstudios/cargo-deny-action) from 2.0.17 to 2.0.18.
- [Release notes](https://github.com/embarkstudios/cargo-deny-action/releases)
- [Commits](EmbarkStudios/cargo-deny-action@91bf2b6...6c8f9fa)

---
updated-dependencies:
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-version: 2.0.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [spin](https://github.com/zesterer/spin-rs) from 0.10.0 to 0.11.0.
- [Changelog](https://github.com/zesterer/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zesterer/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps spin from 0.11.0 to 0.12.0.

---
updated-dependencies:
- dependency-name: spin
  dependency-version: 0.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Coverage collection via the -c flag was broken due to multiple issues:

- AFL: RUSTFLAGS="-C instrument-coverage" was applied during cargo afl
  build/fuzz, conflicting with AFL's own instrumentation and fork
  server. Coverage profraw files were either corrupt or missing. Fix by
  building a separate non-AFL instrumented binary (without --features
  fuzz) after fuzzing, and replaying the AFL queue through it to
  generate valid coverage data.

- AFL: grcov searched from "." which could pick up stale profdata files
  from other runs. Fix by writing profraw to a dedicated cov_profraw/
  directory and pointing grcov only there.

- AFL: the queue replay glob (queue/*) included the .state directory,
  causing panics. Fix by using find -type f to iterate only regular
  files.

- Libfuzzer: grcov --binary-path pointed to
  fuzz/target/x86_64-unknown-linux-gnu/release/<target> (a file) but
  should be the release/ directory. Additionally, grcov searched from
  "." picking up incompatible profdata. Fix by pointing grcov to the
  specific fuzz/coverage/<target>/raw directory where cargo fuzz
  coverage writes profraw files.

- Libfuzzer run_all_case: inverted conditional (if [ ! -d ... ]) meant
  the old coverage directory was never cleaned up. Fix the logic.

Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 45 out of 47 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/devices/virtio_serial/src/lib.rs:786

  • If dma_allocation has no record for buffer.addr, this now silently skips the buffer but still returns Ok(()), leaving remaining unchanged and effectively dropping data while the caller thinks it was consumed. Return an error (e.g., InvalidParameter) when the DMA record is missing, or otherwise ensure remaining is accounted for and the buffer is safely handled/freed.
            if let Some(record) = self.dma_allocation.get(&buffer.addr) {
                let safe_len = core::cmp::min(buffer.len as usize, record.dma_size);
                let dma_buf = unsafe { from_raw_parts(buffer.addr as *const u8, safe_len) };

                let mut data_buf = Vec::new();
                let used_len = core::cmp::min(core::cmp::min(len, buffer.len) as usize, safe_len);
                data_buf.extend_from_slice(&dma_buf[..used_len]);
                remaining = remaining
                    .checked_sub(used_len as u32)
                    .ok_or(VirtioSerialError::InvalidParameter)?;
                Self::port_queue_push(port_id, data_buf)?;

                self.free_dma_memory(buffer.addr)
                    .ok_or(VirtioSerialError::OutOfResource)?;
            }
        }

Comment thread src/migtd/src/migration/rebinding.rs
Comment thread src/migtd/src/migration/rebinding.rs
Comment thread src/migtd/src/mig_policy.rs
Comment thread src/migtd/src/mig_policy.rs
@haitaohuang haitaohuang marked this pull request as ready for review May 22, 2026 22:22
@haitaohuang
Copy link
Copy Markdown
Collaborator Author

Bypass rules to merge all intel changes. issues reported and tracked in intel repo issues and #183
Build will be fixed later in integration branch. Need merge this to move forward

@haitaohuang haitaohuang reopened this May 22, 2026
@haitaohuang haitaohuang merged commit f7a6b70 into microsoft:main May 22, 2026
74 of 118 checks passed
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.

7 participants