From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org,
torvalds@linux-foundation.org, bp@alien8.de, brgerst@gmail.com,
dvlasenk@redhat.com, jpoimboe@redhat.com,
linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com,
tedheadster@gmail.com, luto@kernel.org
Subject: [tip:x86/urgent] x86/boot: Fail the boot if !M486 and CPUID is missing
Date: Mon, 21 Nov 2016 00:48:51 -0800 [thread overview]
Message-ID: <tip-ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98@git.kernel.org> (raw)
In-Reply-To: <70eac6639f23df8be5fe03fa1984aedd5d40077a.1479598603.git.luto@kernel.org>
Commit-ID: ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98
Gitweb: http://git.kernel.org/tip/ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98
Author: Andy Lutomirski <luto@kernel.org>
AuthorDate: Sat, 19 Nov 2016 15:37:30 -0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 21 Nov 2016 09:04:32 +0100
x86/boot: Fail the boot if !M486 and CPUID is missing
Linux will have all kinds of sporadic problems on systems that don't
have the CPUID instruction unless CONFIG_M486=y. In particular,
sync_core() will explode.
I believe that these kernels had a better chance of working before
commit 05fb3c199bb0 ("x86/boot: Initialize FPU and X86_FEATURE_ALWAYS
even if we don't have CPUID"). That commit inadvertently fixed a
serious bug: we used to fail to detect the FPU if CPUID wasn't
present. Because we also used to forget to set X86_FEATURE_ALWAYS, we
end up with no cpu feature bits set at all. This meant that
alternative patching didn't do anything and, if paravirt was disabled,
we could plausibly finish the entire boot process without calling
sync_core().
Rather than trying to work around these issues, just have the kernel
fail loudly if it's running on a CPUID-less 486, doesn't have CPUID,
and doesn't have CONFIG_M486 set.
Reported-by: Matthew Whitehead <tedheadster@gmail.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/70eac6639f23df8be5fe03fa1984aedd5d40077a.1479598603.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/boot/cpu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 26240dd..4224ede 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -87,6 +87,12 @@ int validate_cpu(void)
return -1;
}
+ if (CONFIG_X86_MINIMUM_CPU_FAMILY <= 4 && !IS_ENABLED(CONFIG_M486) &&
+ !has_eflag(X86_EFLAGS_ID)) {
+ printf("This kernel requires a CPU with the CPUID instruction. Build with CONFIG_M486=y to run on this CPU.\n");
+ return -1;
+ }
+
if (err_flags) {
puts("This kernel requires the following features "
"not present on the CPU:\n");
next prev parent reply other threads:[~2016-11-21 8:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-19 23:37 [PATCH] " Andy Lutomirski
2016-11-20 11:19 ` Borislav Petkov
2016-11-20 16:22 ` Andy Lutomirski
2016-11-20 17:32 ` Borislav Petkov
2016-11-20 19:34 ` Henrique de Moraes Holschuh
2016-11-20 20:47 ` Borislav Petkov
2016-11-21 8:48 ` tip-bot for Andy Lutomirski [this message]
2016-11-30 13:18 ` One Thousand Gnomes
2016-11-30 18:28 ` Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-ed68d7e9b9cfb64f3045ffbcb108df03c09a0f98@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tedheadster@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome