* [REGRESSION]: x86/idt: Move early IDT setup out of 32-bit asm
@ 2017-10-14 16:04 tedheadster
2017-10-16 10:25 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: tedheadster @ 2017-10-14 16:04 UTC (permalink / raw)
To: Thomas Gleixner, linux-kernel@vger.kernel.org; +Cc: Andy Lutomirski
Thomas,
I bisected a bug to commit 87e81786b13b267c4355e0d23e33c7e4c08fa63f.
On first generation i486 processors it immediately resets the system
after the "Booting the kernel" message.
- Matthew Whitehead
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [REGRESSION]: x86/idt: Move early IDT setup out of 32-bit asm
2017-10-14 16:04 [REGRESSION]: x86/idt: Move early IDT setup out of 32-bit asm tedheadster
@ 2017-10-16 10:25 ` Thomas Gleixner
2017-10-16 16:10 ` tedheadster
2017-10-16 18:52 ` [tip:x86/urgent] x86/idt: Initialize early IDT before cr4_init_shadow() tip-bot for Thomas Gleixner
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Gleixner @ 2017-10-16 10:25 UTC (permalink / raw)
To: whiteheadm
Cc: linux-kernel@vger.kernel.org, Andy Lutomirski, x86,
Peter Zijlstra
Matthew,
On Sat, 14 Oct 2017, tedheadster wrote:
> I bisected a bug to commit 87e81786b13b267c4355e0d23e33c7e4c08fa63f.
> On first generation i486 processors it immediately resets the system
> after the "Booting the kernel" message.
Duh. Took me a while to understand whats going on. The patch below should
fix that issue.
Thanks,
tglx
8<------------------
Subject: x86/idt: Initialize early IDT before cr4_init_shadow()
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 16 Oct 2017 12:12:16 +0200
Moving the early IDT setup out of assembly code breaks the boot on first
generation 486 systems.
The reason is that the call to setup of these handlers was added after the
call to cr4_init_shadow().
cr4_init_shadow() tries to read CR4 which is not available on those
systems. The accessor function uses a extable fixup to handle the resulting
fault. As the IDT is not set up yet, the cr4 read exception causes an
instantaneous reboot for obvious reasons.
Call idt_setup_early_handler() before cr4_init_shadow() so IDT is set up
before the first exception hits.
Fixes: 87e81786b13b ("x86/idt: Move early IDT setup out of 32-bit asm")
Reported-by: Matthew Whitehead <whiteheadm@acm.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/head32.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -30,10 +30,11 @@ static void __init i386_default_early_se
asmlinkage __visible void __init i386_start_kernel(void)
{
- cr4_init_shadow();
-
+ /* Make sure IDT is set up before any exception happens */
idt_setup_early_handler();
+ cr4_init_shadow();
+
sanitize_boot_params(&boot_params);
x86_early_init_platform_quirks();
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [REGRESSION]: x86/idt: Move early IDT setup out of 32-bit asm
2017-10-16 10:25 ` Thomas Gleixner
@ 2017-10-16 16:10 ` tedheadster
2017-10-16 18:52 ` [tip:x86/urgent] x86/idt: Initialize early IDT before cr4_init_shadow() tip-bot for Thomas Gleixner
1 sibling, 0 replies; 4+ messages in thread
From: tedheadster @ 2017-10-16 16:10 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel@vger.kernel.org, Andy Lutomirski, x86,
Peter Zijlstra
Thomas
On Mon, Oct 16, 2017 at 6:25 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> Matthew,
>
> On Sat, 14 Oct 2017, tedheadster wrote:
>
>> I bisected a bug to commit 87e81786b13b267c4355e0d23e33c7e4c08fa63f.
>> On first generation i486 processors it immediately resets the system
>> after the "Booting the kernel" message.
>
> Duh. Took me a while to understand whats going on. The patch below should
> fix that issue.
>
> Thanks,
>
> tglx
>
I just tested the patch and it worked nicely.
- Matthew Whitehead
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/urgent] x86/idt: Initialize early IDT before cr4_init_shadow()
2017-10-16 10:25 ` Thomas Gleixner
2017-10-16 16:10 ` tedheadster
@ 2017-10-16 18:52 ` tip-bot for Thomas Gleixner
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Thomas Gleixner @ 2017-10-16 18:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: luto, peterz, tglx, mingo, linux-kernel, whiteheadm, hpa
Commit-ID: 9c48c0965b97e14ddcf75490a754e84e05aaa062
Gitweb: https://git.kernel.org/tip/9c48c0965b97e14ddcf75490a754e84e05aaa062
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 16 Oct 2017 12:12:16 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 16 Oct 2017 20:47:37 +0200
x86/idt: Initialize early IDT before cr4_init_shadow()
Moving the early IDT setup out of assembly code breaks the boot on first
generation 486 systems.
The reason is that the call of idt_setup_early_handler, which sets up the
early handlers was added after the call to cr4_init_shadow().
cr4_init_shadow() tries to read CR4 which is not available on those
systems. The accessor function uses a extable fixup to handle the resulting
fault. As the IDT is not set up yet, the cr4 read exception causes an
instantaneous reboot for obvious reasons.
Call idt_setup_early_handler() before cr4_init_shadow() so IDT is set up
before the first exception hits.
Fixes: 87e81786b13b ("x86/idt: Move early IDT setup out of 32-bit asm")
Reported-and-tested-by: Matthew Whitehead <whiteheadm@acm.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1710161210290.1973@nanos
---
arch/x86/kernel/head32.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index cf2ce06..2902ca4 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -30,10 +30,11 @@ static void __init i386_default_early_setup(void)
asmlinkage __visible void __init i386_start_kernel(void)
{
- cr4_init_shadow();
-
+ /* Make sure IDT is set up before any exception happens */
idt_setup_early_handler();
+ cr4_init_shadow();
+
sanitize_boot_params(&boot_params);
x86_early_init_platform_quirks();
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-16 18:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-14 16:04 [REGRESSION]: x86/idt: Move early IDT setup out of 32-bit asm tedheadster
2017-10-16 10:25 ` Thomas Gleixner
2017-10-16 16:10 ` tedheadster
2017-10-16 18:52 ` [tip:x86/urgent] x86/idt: Initialize early IDT before cr4_init_shadow() tip-bot for Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox