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:   Wed, 22 Jun 2022 14:22:07 +0000
From:   "Durrant, Paul" <pdurrant@...zon.co.uk>
To:     David Woodhouse <dwmw2@...radead.org>,
        "x86@...nel.org" <x86@...nel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>
Subject: RE: [PATCH v2] KVM: x86/xen: Update Xen CPUID Leaf 4 (tsc info) sub-leaves,
 if present

> -----Original Message-----
> From: David Woodhouse <dwmw2@...radead.org>
> Sent: 22 June 2022 14:48
> To: Durrant, Paul <pdurrant@...zon.co.uk>; x86@...nel.org; kvm@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Cc: Paolo Bonzini <pbonzini@...hat.com>; Sean Christopherson <seanjc@...gle.com>; Vitaly Kuznetsov
> <vkuznets@...hat.com>; Wanpeng Li <wanpengli@...cent.com>; Jim Mattson <jmattson@...gle.com>; Joerg
> Roedel <joro@...tes.org>; Thomas Gleixner <tglx@...utronix.de>; Ingo Molnar <mingo@...hat.com>;
> Borislav Petkov <bp@...en8.de>; Dave Hansen <dave.hansen@...ux.intel.com>; H. Peter Anvin
> <hpa@...or.com>
> Subject: RE: [EXTERNAL][PATCH v2] KVM: x86/xen: Update Xen CPUID Leaf 4 (tsc info) sub-leaves, if
> present
> 
> On Wed, 2022-06-22 at 10:57 +0100, Paul Durrant wrote:
> > +void kvm_xen_set_cpuid(struct kvm_vcpu *vcpu)
> > +{
> > +	u32 base = 0;
> > +	u32 function;
> > +
> > +	vcpu->arch.xen.tsc_info_1 = NULL;
> > +	vcpu->arch.xen.tsc_info_2 = NULL;
> > +
> > +	for_each_possible_hypervisor_cpuid_base(function) {
> > +		struct kvm_cpuid_entry2 *entry = kvm_find_cpuid_entry(vcpu, function, 0);
> > +
> > +		if (entry &&
> > +		    entry->ebx == XEN_CPUID_SIGNATURE_EBX &&
> > +		    entry->ecx == XEN_CPUID_SIGNATURE_ECX &&
> > +		    entry->edx == XEN_CPUID_SIGNATURE_EDX) {
> > +			base = function;
> > +			break;
> > +		}
> > +	}
> 
> Please make it return if entry->eax < 3 here. There probably aren't any
> *good* reasons why a leaf at 0x40000x03 would exist and belong to some
> other entity (Hyper-V, etc.). Those other extra ranges of CPUID are
> generally aligned at multiples of 0x100, not just the *next* available
> leaf.
> 
> But I don't care. Unless eax on the main Xen leaf is 3 or more, the
> leaf at N+3 isn't yours to reason about :)
> 

According to https://lwn.net/Articles/301888 (which is ancient), the Microsoft TLFS and my copy of the Xen source code, it seems everyone does agree that the hypervisor base leaf EAX does specify the maximum leaf (in absolute terms rather than the offset) so I'll add that check into v3.

  Paul

> > +	if (!base)
> > +		return;
> > +
> > +	function = base | XEN_CPUID_LEAF(3);
> > +	vcpu->arch.xen.tsc_info_1 = kvm_find_cpuid_entry(vcpu, function, 1);
> > +	vcpu->arch.xen.tsc_info_2 = kvm_find_cpuid_entry(vcpu, function, 2);
> > +}
> > +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ