Re: [PATCH] KVM: VMX: Compare against correct size of __launched member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 16 Sep 2018, at 2:08, Johannes Erdfelt <johannes@xxxxxxxxxxx> wrote:
> 
> The bool type is 8-bits, but some assembly code in vmx_vcpu_run
> compares the __launched member as 32-bits. While the current layout
> of the structure leaves 24-bits of padding after __launched, adding
> members with small types after __launched or rearranging members could
> result in a "KVM: entry failed, hardware error 0x5" error.
> 
> Signed-off-by: Johannes Erdfelt <johannes@xxxxxxxxxxx>
> ---
> arch/x86/kvm/vmx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 1d26f3c..c802b25 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -10714,7 +10714,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
> 		"mov %%" _ASM_AX", %%cr2 \n\t"
> 		"3: \n\t"
> 		/* Check if vmlaunch of vmresume is needed */
> -		"cmpl $0, %c[launched](%0) \n\t"
> +		"cmpb $0, %c[launched](%0) \n\t"
> 		/* Load guest registers.  Don't clobber flags. */
> 		"mov %c[rax](%0), %%" _ASM_AX " \n\t"
> 		"mov %c[rbx](%0), %%" _ASM_BX " \n\t"
> -- 
> 2.7.4
> 

Reviewed-by: Liran Alon <liran.alon@xxxxxxxxxx>





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux