Skip to content

Commit f7d31e6

Browse files
ariloubonzini
authored andcommitted
x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit
The problem the patch is trying to address is the fact that 'struct kvm_hyperv_exit' has different layout on when compiling in 32 and 64 bit modes. In 64-bit mode the default alignment boundary is 64 bits thus forcing extra gaps after 'type' and 'msr' but in 32-bit mode the boundary is at 32 bits thus no extra gaps. This is an issue as even when the kernel is 64 bit, the userspace using the interface can be both 32 and 64 bit but the same 32 bit userspace has to work with 32 bit kernel. The issue is fixed by forcing the 64 bit layout, this leads to ABI change for 32 bit builds and while we are obviously breaking '32 bit userspace with 32 bit kernel' case, we're fixing the '32 bit userspace with 64 bit kernel' one. As the interface has no (known) users and 32 bit KVM is rather baroque nowadays, this seems like a reasonable decision. Reviewed-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Jon Doron <[email protected]> Message-Id: <[email protected]> Reviewed-by: Roman Kagan <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 27461da commit f7d31e6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5067,9 +5067,11 @@ EOI was received.
50675067
#define KVM_EXIT_HYPERV_SYNIC 1
50685068
#define KVM_EXIT_HYPERV_HCALL 2
50695069
__u32 type;
5070+
__u32 pad1;
50705071
union {
50715072
struct {
50725073
__u32 msr;
5074+
__u32 pad2;
50735075
__u64 control;
50745076
__u64 evt_page;
50755077
__u64 msg_page;

include/uapi/linux/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,11 @@ struct kvm_hyperv_exit {
189189
#define KVM_EXIT_HYPERV_SYNIC 1
190190
#define KVM_EXIT_HYPERV_HCALL 2
191191
__u32 type;
192+
__u32 pad1;
192193
union {
193194
struct {
194195
__u32 msr;
196+
__u32 pad2;
195197
__u64 control;
196198
__u64 evt_page;
197199
__u64 msg_page;

0 commit comments

Comments
 (0)