Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1327138e authored by Adrian Bunk's avatar Adrian Bunk Committed by Avi Kivity
Browse files

KVM: fix userspace ABI breakage



The following part of commit 9ef621d3
(KVM: Support mixed endian machines) changed on the size of a struct
that is exported to userspace:

include/linux/kvm.h:

@@ -318,14 +318,14 @@ struct kvm_trace_rec {
 	__u32 vcpu_id;
 	union {
 		struct {
-			__u32 cycle_lo, cycle_hi;
+			__u64 cycle_u64;
 			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
 		} cycle;
 		struct {
 			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
 		} nocycle;
 	} u;
-};
+} __attribute__((packed));

Packing a struct was the correct idea, but it packed the wrong struct.

Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent cd5998eb
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -320,12 +320,12 @@ struct kvm_trace_rec {
		struct {
		struct {
			__u64 cycle_u64;
			__u64 cycle_u64;
			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
		} cycle;
		} __attribute__((packed)) cycle;
		struct {
		struct {
			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
		} nocycle;
		} nocycle;
	} u;
	} u;
} __attribute__((packed));
};


#define KVMIO 0xAE
#define KVMIO 0xAE