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] [day] [month] [year] [list]
Date:   Thu, 2 Aug 2018 14:58:30 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Tianyu Lan <Tianyu.Lan@...rosoft.com>
Cc:     "rkrcmar@...hat.com" <rkrcmar@...hat.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "hpa@...or.com" <hpa@...or.com>, "x86@...nel.org" <x86@...nel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [Resend PATCH] KVM/x86: Move X86_CR4_OSXSAVE check into
 kvm_valid_sregs()

On 23/07/2018 14:31, Tianyu Lan wrote:
> X86_CR4_OSXSAVE check belongs to sregs check and so move into
> kvm_valid_sregs().
> 
> Signed-off-by: Lan Tianyu <Tianyu.Lan@...rosoft.com>
> ---
>  arch/x86/kvm/x86.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 153564db7980..5c9acdbb2020 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8045,6 +8045,10 @@ EXPORT_SYMBOL_GPL(kvm_task_switch);
>  
>  static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
>  {
> +	if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
> +			(sregs->cr4 & X86_CR4_OSXSAVE))
> +		return  -EINVAL;
> +
>  	if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) {
>  		/*
>  		 * When EFER.LME and CR0.PG are set, the processor is in
> @@ -8075,10 +8079,6 @@ static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
>  	struct desc_ptr dt;
>  	int ret = -EINVAL;
>  
> -	if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
> -			(sregs->cr4 & X86_CR4_OSXSAVE))
> -		goto out;
> -
>  	if (kvm_valid_sregs(vcpu, sregs))
>  		goto out;
>  
> 

Queued, thanks.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ