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, 10 Apr 2013 23:29:50 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Ingo Molnar <mingo@...nel.org>, X86 ML <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>, Borislav Petkov <bp@...e.de>
Subject: [PATCH] x86, FPU: Fix FPU initialization

On Wed, Apr 10, 2013 at 06:11:22PM +0200, Borislav Petkov wrote:
> On Wed, Apr 10, 2013 at 08:35:43AM -0700, H. Peter Anvin wrote:
> > OK, this thread took off in another direction but you're still looking
> > at this, right?
> 
> Yep, and I think I have the rootcause, let's start (oops below for
> info).

Ok, here's a fix which boots fine here in qemu. Ingo, it would be cool
if you gave it a run to verify.

Thanks.

--
>From 2263430417dd8de1a5fef4b2c40127e681fdc1ab Mon Sep 17 00:00:00 2001
From: Borislav Petkov <bp@...e.de>
Date: Wed, 10 Apr 2013 21:37:03 +0200
Subject: [PATCH] x86, FPU: Fix FPU initialization

c70293d0e3fe ("x86: Get rid of ->hard_math and all the FPU asm
fu") converted the FPU detection code to C. Yours truly, in his
overzealousness, used static_cpu_has() too early, before alternatives
have run, leading to the checks in fpu_init() to fail and fpu_init() to
set CR0.EM.

This, in turn, lead to an early NULL ptr due to
a chicken-and-an-egg issue (full details here:
http://lkml.kernel.org/r/20130410161122.GI6857@pd.tnic).

Fix it back to the normal CPU feature checks.

Signed-off-by: Borislav Petkov <bp@...e.de>
---
 arch/x86/kernel/i387.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 3a6455304c8d..b0928898bf54 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -163,7 +163,7 @@ void __cpuinit fpu_init(void)
 	unsigned long cr4_mask = 0;
 
 #ifndef CONFIG_MATH_EMULATION
-	if (!static_cpu_has(X86_FEATURE_FPU)) {
+	if (!cpu_has_fpu) {
 		pr_emerg("No FPU found and no math emulation present\n");
 		pr_emerg("Giving up\n");
 		for (;;)
@@ -179,7 +179,7 @@ void __cpuinit fpu_init(void)
 
 	cr0 = read_cr0();
 	cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */
-	if (!static_cpu_has(X86_FEATURE_FPU))
+	if (!cpu_has_fpu)
 		cr0 |= X86_CR0_EM;
 	write_cr0(cr0);
 
-- 
1.8.2.135.g7b592fa


-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ