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
| ||
|
Date: Thu, 20 Jun 2019 12:37:20 +0200 From: Borislav Petkov <bp@...en8.de> To: Fenghua Yu <fenghua.yu@...el.com> 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>, Paolo Bonzini <pbonzini@...hat.com>, Radim Krcmar <rkrcmar@...hat.com>, Ravi V Shankar <ravi.v.shankar@...el.com>, linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org> Subject: Re: [PATCH v2 2/2] x86/cpufeatures: Enumerate new AVX512 BFLOAT16 instructions On Wed, Jun 19, 2019 at 02:34:04PM -0700, Fenghua Yu wrote: > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index efb114298cfb..4910cb421b82 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -847,6 +847,9 @@ void get_cpu_cap(struct cpuinfo_x86 *c) > c->x86_capability[CPUID_7_0_EBX] = ebx; > c->x86_capability[CPUID_7_ECX] = ecx; > c->x86_capability[CPUID_7_EDX] = edx; > + > + cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx); > + c->x86_capability[CPUID_7_1_EAX] = eax; > } You need to test the sub-leaf index validity here before accessing subleaf 1: diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4910cb421b82..dad20bc891d5 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -848,8 +848,11 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_capability[CPUID_7_ECX] = ecx; c->x86_capability[CPUID_7_EDX] = edx; - cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx); - c->x86_capability[CPUID_7_1_EAX] = eax; + /* Check valid sub-leaf index before accessing it */ + if (eax >= 1) { + cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx); + c->x86_capability[CPUID_7_1_EAX] = eax; + } } /* Extended state features: level 0x0000000d */ -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists