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]
Message-Id: <20180921212041.13096-3-tedheadster@gmail.com>
Date:   Fri, 21 Sep 2018 17:20:41 -0400
From:   Matthew Whitehead <tedheadster@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     mingo@...nel.org, tglx@...utronix.de, peterz@...radead.org,
        luto@...capital.net, bp@...en8.de, hpa@...or.com,
        Matthew Whitehead <tedheadster@...il.com>
Subject: [PATCH v2 2/2] x86/cpu: Change query logic so cpuid is enabled before testing

Presently we check for cpuid to be enabled first. If it is not already
enabled, then we next call identify_cpu_without_cpuid() and clear
X86_FEATURE_CPUID.

Unfortunately, identify_cpu_without_cpuid() is the function where cpuid
becomes _enabled_ on Cyrix 6x86/6x86L cpus. So we must reverse the
calling sequence so that cpuid is first enabled, and then check a second
time to see if the feature has now been activated.

Reviewed-by: Andy Lutomirski <luto@...capital.net>
Signed-off-by: Matthew Whitehead <tedheadster@...il.com>
---
 arch/x86/kernel/cpu/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index eb4cb3efd20e..60c7c5ce7e55 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1040,6 +1040,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 	memset(&c->x86_capability, 0, sizeof c->x86_capability);
 	c->extended_cpuid_level = 0;
 
+	if (!have_cpuid_p())
+		identify_cpu_without_cpuid(c);
+	
 	/* cyrix could have cpuid enabled via c_identify()*/
 	if (have_cpuid_p()) {
 		cpu_detect(c);
@@ -1057,7 +1060,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 		if (this_cpu->c_bsp_init)
 			this_cpu->c_bsp_init(c);
 	} else {
-		identify_cpu_without_cpuid(c);
 		setup_clear_cpu_cap(X86_FEATURE_CPUID);
 	}
 
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ