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:   Fri, 14 Jun 2019 06:17:02 -0700
From:   Fenghua Yu <fenghua.yu@...el.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, H Peter Anvin <hpa@...or.com>,
        Christopherson Sean J <sean.j.christopherson@...el.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [RFC PATCH 2/3] x86/cpufeatures: Combine word 11 and 12 into new
 scattered features word 11

On Fri, Jun 14, 2019 at 02:27:50PM +0200, Borislav Petkov wrote:
> On Fri, Jun 14, 2019 at 01:44:10PM +0200, Borislav Petkov wrote:
> > On Thu, Jun 13, 2019 at 01:51:03PM -0700, Fenghua Yu wrote:
> > > It's a waste for the four X86_FEATURE_CQM_* features to occupy two
> > > pure feature bits words. To better utilize feature words, re-define
> > > word 11 to host scattered features and move the four X86_FEATURE_CQM_*
> > > features into word 11. More scattered features can be added in word 11
> > > in the future.
> > > 
> > > KVM doesn't support resctrl now. So it's safe to move the
> > > X86_FEATURE_CQM_* features to scattered features word 11 for KVM.
> > > 
> > > Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
> > 
> > ...
> > 
> > > diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> > > index 9a327d5b6d1f..d78a61408243 100644
> > > --- a/arch/x86/kvm/cpuid.h
> > > +++ b/arch/x86/kvm/cpuid.h
> > > @@ -47,8 +47,6 @@ static const struct cpuid_reg reverse_cpuid[] = {
> > >  	[CPUID_8000_0001_ECX] = {0x80000001, 0, CPUID_ECX},
> > >  	[CPUID_7_0_EBX]       = {         7, 0, CPUID_EBX},
> > >  	[CPUID_D_1_EAX]       = {       0xd, 1, CPUID_EAX},
> > > -	[CPUID_F_0_EDX]       = {       0xf, 0, CPUID_EDX},
> > > -	[CPUID_F_1_EDX]       = {       0xf, 1, CPUID_EDX},
> > 
> > I think you're going to have to change those to:
> > 
> >         [CPUID_LNX_4]         = {         0, 0, 0},
> >         [CPUID_7_1_EAX]       = {         7, 1, CPUID_EAX },
> > 
> > instead of removing them because kvm is basically hardcoding the feature
> > words and then bitches when array elements in the middle get removed:
> 
> Alternatively - and what I think is the better solution - would be to
> remove those BUILD_BUG_ONs in x86_feature_cpuid and filter out the
> Linux-defined leafs dynamically. This way the array won't have holes in
> it.

Maybe adding a dummy slot in cpuid_leafs in patch 0002 to avoid the
compilation errors?

Those KVM BUILD_BUG_ON() want to find out any empty leaf in
reverse_cpuid (and also cpuid_leafs).

The patch 0002 actually creates such empty leaf 12 in cpuid_leafs. So
CPUID_7_EDX=17 instead of NCAPINTS-1=18 in cpuid_leafs. It's not
desired.

After applying patch 0003, the hole is filled in and there is no
compilation error from the KVM BUILD_BUG_ON() checks. So the compilation
errors only happens in bisect.

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 526619906305..403f70c2e431 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -23,6 +23,7 @@ enum cpuid_leafs
        CPUID_7_0_EBX,
        CPUID_D_1_EAX,
        CPUID_LNX_4,
+       CPUID_DUMMY,
        CPUID_8000_0008_EBX,
        CPUID_6_EAX,
        CPUID_8000_000A_EDX,

Is it OK to add the above patch to the patch 0002 to solve the
compilation errors? If it's ok, I will explain in commit message why add
CPUID_DUMMY.

Thanks.

-Fenghua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ