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:   Wed, 14 Nov 2018 22:28:42 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] x86/cpuid: Get vendor ID on the BSP

From: Borislav Petkov <bp@...e.de>

No need to do it on each CPU. Read max base CPUID level on each CPU for
now so that the check in cpu_detect() works.

Signed-off-by: Borislav Petkov <bp@...e.de>
---
 arch/x86/kernel/cpu/common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8a6071614652..f77ca116fba7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -732,15 +732,21 @@ static void get_cpu_vendor(struct cpuinfo_x86 *c)
 	this_cpu = &default_cpu;
 }
 
-void cpu_detect(struct cpuinfo_x86 *c)
+static void cpu_get_vendor_name(void)
 {
-	/* Get vendor name */
-	cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
+	u32 dummy;
+
+	cpuid(0x00000000, &dummy,
 	      (unsigned int *)&x86_vendor_id[0],
 	      (unsigned int *)&x86_vendor_id[8],
 	      (unsigned int *)&x86_vendor_id[4]);
+}
 
+void cpu_detect(struct cpuinfo_x86 *c)
+{
+	c->cpuid_level = cpuid_eax(0);
 	c->x86 = 4;
+
 	/* Intel-defined flags: level 0x00000001 */
 	if (c->cpuid_level >= 0x00000001) {
 		u32 junk, tfms, cap0, misc;
@@ -1082,6 +1088,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 
 	/* cyrix could have cpuid enabled via c_identify()*/
 	if (have_cpuid_p()) {
+		cpu_get_vendor_name();
 		cpu_detect(c);
 		get_cpu_vendor(c);
 		get_cpu_cap(c);
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ