From: Mikael Pettersson <mikpe@csd.uu.se>
To: marcelo.tosatti@cyclades.com
Cc: ak@suse.de, linux-kernel@vger.kernel.org
Subject: [PATCH][2.4.23] fix reboot/no_idt bug
Date: Wed, 3 Dec 2003 23:28:41 +0100 (MET) [thread overview]
Message-ID: <200312032228.hB3MSf92023850@alkaid.it.uu.se> (raw)
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.
reply other threads:[~2003-12-03 22:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200312032228.hB3MSf92023850@alkaid.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
/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
all inboxes | Powered by JetHome®