lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4fa9a87-cc4e-73d6-e248-192ab167b2c2@redhat.com>
Date:   Thu, 1 Feb 2018 13:09:56 -0500
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Radim Krčmář <rkrcmar@...hat.com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     Wanpeng Li <wanpeng.li@...mail.com>, stable@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: fix backward migration with async_PF

On 01/02/2018 12:50, Radim Krčmář wrote:
> Guests on new hypersiors might set KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT
> bit when enabling async_PF, but this bit is reserved on old hypervisors,
> which results in a failure upon migration.
> 
> Guests at least expect that KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT might not
> be present when booting, so we allow userspace to handle migration
> compatibility by adding a KVM CPUID flag that determines the presence of
> KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT.
> 
> Fixes: 52a5c155cf79 ("KVM: async_pf: Let guest support delivery of async_pf from guest mode")
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Radim Krčmář <rkrcmar@...hat.com>

This has to be documented in Documentation/virtual/kvm/cpuid.txt.

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 4c3103f449a3..c16740a06f0c 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2139,8 +2139,10 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
>  {
>  	gpa_t gpa = data & ~0x3f;
>  
> -	/* Bits 3:5 are reserved, Should be zero */
> -	if (data & 0x38)
> +	/* Bits 3:5 are reserved, Should be zero. */
> +	if (data & 0x38 ||
> +	    (data & KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT &&
> +	     !guest_kvm_cpuid_has(vcpu, KVM_FEATURE_ASYNC_PF_VMEXIT)))
>  		return 1;
>  
>  	vcpu->arch.apf.msr_val = data;
> 

This check will break migration if the source guest and host both have
the recent kernels which support KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT, so
I am not sure about it.  Otherwise, the patch is okay!

Thanks,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ