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]
Message-ID: <c3f4d7d4-59b1-088d-cc85-ccd55d9e2e79@redhat.com>
Date:   Fri, 11 Sep 2020 19:27:13 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>
Cc:     kvm@...r.kernel.org, Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        "Dr . David Alan Gilbert" <dgilbert@...hat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: always allow writing '0' to MSR_KVM_ASYNC_PF_EN

On 11/09/20 18:04, Sean Christopherson wrote:

> This doesn't actually verify that @data == 0.  kvm_pv_async_pf_enabled()
> returns true iff KVM_ASYNC_PF_ENABLED and KVM_ASYNC_PF_DELIVERY_AS_INT are
> set, e.g. this would allow setting one and not the other.  This also allows
> userspace to set vcpu->arch.apf.msr_en_val to an unsupported value, i.e.
> @data has already been propagated to the vcpu and isn't unwound.
> 
> Why not just pivot on @data when lapic_in_kernel() is false?  vcpu->arch.apic
> is immutable so there's no need to update apf.msr_en_val in either direction.
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 539ea1cd6020..36969d5ec291 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2735,7 +2735,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
>                 return 1;
> 
>         if (!lapic_in_kernel(vcpu))
> -               return 1;
> +               return data ? 1 : 0;
> 
>         vcpu->arch.apf.msr_en_val = data;
> 
> 
>> +		return 1;
>> +
>>  	if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa,
>>  					sizeof(u64)))
>>  		return 1;
>> -- 
>> 2.25.4
>>
> 

Committed this instead, though.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ