lkml.org 
[lkml]   [2003]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][2.4.23] fix reboot/no_idt bug
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.023 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site