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]
Date:   Thu, 5 Jan 2023 18:09:57 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paul Durrant <xadimgnik@...il.com>
Cc:     Paul Durrant <pdurrant@...zon.com>, x86@...nel.org,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH v6 1/2] KVM: x86/cpuid: generalize
 kvm_update_kvm_cpuid_base() and also capture limit

On Thu, Jan 05, 2023, Paul Durrant wrote:
> On 04/01/2023 19:34, Sean Christopherson wrote:
> > Since the struct is a 64-bit value, what about making this a pure getter that
> > returns a copy?
> > 
> > static struct kvm_hypervisor_cpuid kvm_get_hypervisor_cpuid(struct kvm_vcpu *vcpu,
> > 							    const char *sig)
> > {
> > 	struct kvm_hypervisor_cpuid cpuid = {};
> > 	struct kvm_cpuid_entry2 *entry;
> > 	u32 function;
> > 
> > 	for_each_possible_hypervisor_cpuid_base(cpuid.base) {
> > 		entry = kvm_find_cpuid_entry(vcpu, function);
> > 
> > 		if (entry) {
> > 			u32 signature[3];
> > 
> > 			signature[0] = entry->ebx;
> > 			signature[1] = entry->ecx;
> > 			signature[2] = entry->edx;
> > 
> > 			if (!memcmp(signature, sig, sizeof(signature))) {
> > 				cpuid.base = function;
> > 				cpuid.limit = entry->eax;
> > 				break;
> > 			}
> > 		}
> > 	}
> > 
> > 	return cpuid;
> > }
> > 
> > 
> > 	vcpu->arch.kvm_cpuid = kvm_get_hypervisor_cpuid(vcpu, KVM_SIGNATURE);
> > 	vcpu->arch.xen.cpuid = kvm_get_hypervisor_cpuid(vcpu, XEN_SIGNATURE);
> 
> Yes, if that's preferable then no problem.

I like it (obviously), but it's probably worth waiting a few days to see what
others think before posting a new version.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ