[PATCH] fix sysenter crash with enabled nmi oopser

manfred@colorfullife.com
Sat, 31 May 2003 20:08:19 +0200 (CEST)


Hi Linus,

below is again my patch to the nmi entry point: without it, I can't boot
RH9 with both nmi oopser and page unmapping enabled.

Background:

The nmi handler must detect the combination of nmi+syscall+debug fault. It
does that by reading from (%esp)16. This can crash, if it's a "normal" nmi
and (%esp)16 doesn't exist - either above end-of-memory, or the page that
follows behind the stack is unmapped for AGP GART. RH9 crashes on every
boot with page unmap debugging enabled, the interrupted %eip is
sysenter_past_esp.

Could you apply the patch to your tree? I would prefer a symbolic constant
instead of 0x1fff (THREAD_SIZE-1) and 0x1fec
(THREAD_SIZE-3*sizeof(unsigned long)), but the current definitions are not
compatible with the assembler.

--
	Manfred
<<<
--- 2.5/arch/i386/kernel/entry.S	2003-05-24 07:56:36.000000000 +0200
+++ build-2.5/arch/i386/kernel/entry.S	2003-05-25 22:56:18.000000000 +0200
@@ -534,6 +534,15 @@
 ENTRY(nmi)
 	cmpl $sysenter_entry,(%esp)
 	je nmi_stack_fixup
+	pushl %eax
+	movl %esp,%eax
+	/* Do not access memory above the end of our stack page,
+	 * it might not exist.
+	 */
+	andl $0x1fff,%eax
+	cmpl $0x1fec,%eax
+	popl %eax
+	jae nmi_stack_correct
 	cmpl $sysenter_entry,12(%esp)
 	je nmi_debug_stack_check
 nmi_stack_correct:
<<<

- 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/