* [PATCH][2.4.23] fix reboot/no_idt bug
@ 2003-12-03 22:28 Mikael Pettersson
0 siblings, 0 replies; only message in thread
From: Mikael Pettersson @ 2003-12-03 22:28 UTC (permalink / raw)
To: marcelo.tosatti; +Cc: ak, linux-kernel
When compiling 2.4.23 with gcc-3.3.2, gcc generates the
following warning for arch/i386/kernel/process.c:
process.c: In function `machine_restart':
process.c:427: warning: use of memory input without lvalue in asm operand 0 is deprecated
The warning identifies a real bug. no_idt is passed to
lidt with an "m" constraint, which requires an l-value.
Since no_idt is faked as an array, gcc creates an anonymous
variable pointing to no_idt and passes that to lidt(*),
so at runtime lidt sees the wrong address. Not good.
(The bug, while real, is unlikely to trigger since it
sits in an infrequently used path in the reboot code.)
The fix is to make no_idt a struct (and thus an l-lvalue)
like the other gdt/idt descriptors.
This patch is a backport of the fix Linus made for the
same bug in 2.6.0-test4.
[Andi: x86-64 appears to have the same bug]
(*) Verified by inspection of the assembly code.
/Mikael
diff -ruN linux-2.4.23/arch/i386/kernel/process.c linux-2.4.23.no_idt-fix/arch/i386/kernel/process.c
--- linux-2.4.23/arch/i386/kernel/process.c 2003-11-29 00:28:10.000000000 +0100
+++ linux-2.4.23.no_idt-fix/arch/i386/kernel/process.c 2003-12-03 20:20:58.000000000 +0100
@@ -153,7 +153,6 @@
__setup("idle=", idle_setup);
-static long no_idt[2];
static int reboot_mode;
int reboot_thru_bios;
@@ -224,7 +223,8 @@
unsigned long long * base __attribute__ ((packed));
}
real_mode_gdt = { sizeof (real_mode_gdt_entries) - 1, real_mode_gdt_entries },
-real_mode_idt = { 0x3ff, 0 };
+real_mode_idt = { 0x3ff, 0 },
+no_idt = { 0, 0 };
/* This is 16-bit protected mode code to disable paging and the cache,
switch to real mode and jump to the BIOS reset code.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-12-03 22:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-03 22:28 [PATCH][2.4.23] fix reboot/no_idt bug Mikael Pettersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®