fix(vmcall_raw): chunk send to honor VMCALL buffer MTU#918
Merged
Conversation
MichalTarnacki
approved these changes
Jun 30, 2026
kornelo
approved these changes
Jun 30, 2026
A single TDG.VP.VMCALL<Service.MigTD.Send> can only carry up to the same MTU the receive side advertises (MAX_VMCALL_RAW_STREAM_MTU, 64KB). With policy_v2's peer-data blob now carrying the signed policy plus issuer chain (~180KB in practice), the rebinding pre-session body send fails with TdVmcallError::Other right after hello and the 8-byte data header succeed. Chunk on the send path so any single VMCALL payload stays at MAX_VMCALL_RAW_STREAM_MTU - 12 bytes (room for the GHCI 1.5 status+length header prepended by vmcall_raw_transport_enqueue). Loop inside VmcallRaw::send and keep returning buf.len(); this keeps the AsyncWrite contract intact for callers that don't loop on partial writes (rustls SecureChannel, SpdmDeviceIo). The wire framing is unchanged — the peer's receive loop already reassembles multiple packets in VmcallRaw::recv. Promote MAX_VMCALL_RAW_STREAM_MTU to pub(crate) and add explicit VMCALL_RAW_GHCI_HEADER_LEN / VMCALL_RAW_SEND_PAYLOAD_MTU consts so the overhead arithmetic is named at one site. Signed-off-by: Stanislaw Grams <stanislaw.grams@intel.com>
bd9b144 to
f39f3f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A single TDG.VP.VMCALL<Service.MigTD.Send> can only carry up to the same MTU the receive side advertises (MAX_VMCALL_RAW_STREAM_MTU, 64KB). With policy_v2's peer-data blob now carrying the signed policy plus issuer chain (~180KB in practice), the rebinding pre-session body send fails with TdVmcallError::Other right after hello and the 8-byte data header succeed.
Chunk on the send path so any single VMCALL payload stays at MAX_VMCALL_RAW_STREAM_MTU - 12 bytes (room for the GHCI 1.5 status+length header prepended by vmcall_raw_transport_enqueue). Loop inside VmcallRaw::send and keep returning buf.len(); this keeps the AsyncWrite contract intact for callers that don't loop on partial writes (rustls SecureChannel, SpdmDeviceIo). The wire framing is unchanged — the peer's receive loop already reassembles multiple packets in VmcallRaw::recv.
Promote MAX_VMCALL_RAW_STREAM_MTU to pub(crate) and add explicit VMCALL_RAW_GHCI_HEADER_LEN / VMCALL_RAW_SEND_PAYLOAD_MTU consts so the overhead arithmetic is named at one site.