Merged
Conversation
Contributor
Author
|
@qwandor Could you please take a look? |
qwandor
reviewed
Nov 20, 2025
src/transport/x86_64/hypercalls.rs
Outdated
| signature.to_le_bytes() | ||
| } | ||
|
|
||
| macro_rules! __vmcall_impl { |
Collaborator
There was a problem hiding this comment.
Can this just be a simple function rather than a macro? The caller can pass zeroes for any unused parameters, and cast everything to u64.
Contributor
Author
There was a problem hiding this comment.
Done - use simple function rather than a macro. I've left the macro wrapper so the caller do not have to care about zeroing not used arguments.
3705209 to
a583136
Compare
qwandor
reviewed
Nov 20, 2025
src/transport/x86_64/hypercalls.rs
Outdated
| ); | ||
| } | ||
| data | ||
| core::arch::asm!( |
Collaborator
There was a problem hiding this comment.
There's already a use statement for asm, no need to use the full path here.
Contributor
Author
There was a problem hiding this comment.
Yeah, thx.
The pKVM hypervisor forwards PKVM_GHC_IOWRITE and PKVM_GHC_IOWREAD to pKVM host for emulation. In such case, guest registers values in RAX, RBX, RCX, RDX and RSI might become visible to the host. To prevent potential unintended information leakage, introduce vmcall macro which zeros not used hyperacall arguments, and use it for PKVM_GHC_IOWRITE/PKVM_GHC_IOWREAD hypercall to make sure that unused RDX or RSI are set to 0.
a583136 to
2e7b9ce
Compare
qwandor
approved these changes
Nov 20, 2025
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.
The pKVM hypervisor forwards PKVM_GHC_IOWRITE and PKVM_GHC_IOWREAD to pKVM host for emulation. In such case, guest registers values in RAX, RBX, RCX, RDX and RSI might become visible to the host.
To prevent potential unintended information leakage, introduce vmcall macro which zeros not used hyperacall arguments, and use it for PKVM_GHC_IOWRITE/PKVM_GHC_IOWREAD hypercall to make sure that unused RDX or RSI are set to 0.