--- Begin Message ---
- Subject: No Subject
- From:
- Date: Mon, 28 Mar 2005 17:35:11 +0530
From: "Vivek Goyal" <[email protected]>
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 <[email protected]>
---
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);
_
--- End Message ---
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]