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: <1f45de43-af43-24da-b7d3-00b9d2bd517c@intel.com>
Date:   Thu, 28 May 2020 23:40:26 +0800
From:   Xiaoyao Li <xiaoyao.li@...el.com>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        kvm@...r.kernel.org
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Jim Mattson <jmattson@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: X86: Call kvm_x86_ops.cpuid_update() after CPUIDs
 fully updated

On 5/28/2020 11:22 PM, Paolo Bonzini wrote:
> On 28/05/20 17:19, Xiaoyao Li wrote:
>> kvm_x86_ops.cpuid_update() is used to update vmx/svm settings based on
>> updated CPUID settings. So it's supposed to be called after CPUIDs are
>> fully updated, not in the middle stage.
>>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
> 
> Are you seeing anything bad happening from this?

Not yet.

IMO changing the order is more reasonable and less confusing.

> Paolo
> 
>> ---
>>   arch/x86/kvm/cpuid.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>> index cd708b0b460a..753739bc1bf0 100644
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>> @@ -208,8 +208,11 @@ int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
>>   	vcpu->arch.cpuid_nent = cpuid->nent;
>>   	cpuid_fix_nx_cap(vcpu);
>>   	kvm_apic_set_version(vcpu);
>> -	kvm_x86_ops.cpuid_update(vcpu);
>>   	r = kvm_update_cpuid(vcpu);
>> +	if (r)
>> +		goto out;
>> +
>> +	kvm_x86_ops.cpuid_update(vcpu);
>>   
>>   out:
>>   	vfree(cpuid_entries);
>> @@ -231,8 +234,11 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
>>   		goto out;
>>   	vcpu->arch.cpuid_nent = cpuid->nent;
>>   	kvm_apic_set_version(vcpu);
>> -	kvm_x86_ops.cpuid_update(vcpu);
>>   	r = kvm_update_cpuid(vcpu);
>> +	if (r)
>> +		goto out;
>> +
>> +	kvm_x86_ops.cpuid_update(vcpu);
>>   out:
>>   	return r;
>>   }
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ