* [RFC/PATCH 6/17][Kdump] NMI handler segment selector, stack pointer fix
@ 2005-03-28 13:26 Vivek Goyal
0 siblings, 0 replies; only message in thread
From: Vivek Goyal @ 2005-03-28 13:26 UTC (permalink / raw)
To: Andrew Morton, lkml; +Cc: Eric W. Biederman, fastboot
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: x86-nmi-handler-ss-esp-fix.patch --]
[-- Type: message/rfc822, Size: 1578 bytes --]
From:
Subject: No Subject
Date: Mon, 28 Mar 2005 17:35:11 +0530
Message-ID: <1112011511.4001.22.camel@localhost.localdomain>
From: "Vivek Goyal" <vgoyal@in.ibm.com>
o CPU does not save ss and esp on stack if execution was already in kernel
mode at the time of NMI occurrence. This leads to saving of erractic values
for ss and esp. This patch fixes the issue.
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---
linux-2.6.12-rc1-mm3-1M-root/arch/i386/kernel/crash.c | 13 +++++++++++++
1 files changed, 13 insertions(+)
diff -puN arch/i386/kernel/crash.c~x86-nmi-handler-ss-esp-fix arch/i386/kernel/crash.c
--- linux-2.6.12-rc1-mm3-1M/arch/i386/kernel/crash.c~x86-nmi-handler-ss-esp-fix 2005-03-27 18:50:50.000000000 +0530
+++ linux-2.6.12-rc1-mm3-1M-root/arch/i386/kernel/crash.c 2005-03-27 18:56:16.000000000 +0530
@@ -112,7 +112,20 @@ static atomic_t waiting_for_crash_ipi;
static int crash_nmi_callback(struct pt_regs *regs, int cpu)
{
+ struct pt_regs fixed_regs;
local_irq_disable();
+
+ /* CPU does not save ss and esp on stack if execution is already
+ * running in kernel mode at the time of NMI occurrence. This code
+ * fixes it.
+ */
+ if (!user_mode(regs)) {
+ memcpy(&fixed_regs, regs, sizeof(*regs));
+ fixed_regs.esp = (unsigned long)&(regs->esp);
+ __asm__ __volatile__("xorl %eax, %eax;");
+ __asm__ __volatile__ ("movw %%ss, %%ax;" :"=a"(fixed_regs.xss));
+ regs = &fixed_regs;
+ }
crash_save_this_cpu(regs, cpu);
disable_local_APIC();
atomic_dec(&waiting_for_crash_ipi);
_
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-28 13:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-28 13:26 [RFC/PATCH 6/17][Kdump] NMI handler segment selector, stack pointer fix Vivek Goyal
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®