public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: linux-kernel@vger.kernel.org
Cc: Riley@Williams.Name, davej@redhat.com, pageexec@freemail.hu
Subject: [PATCH][RFC] exception processing in early boot
Date: Wed, 30 Aug 2006 08:39:32 +0200	[thread overview]
Message-ID: <20060830063932.GB289@1wt.eu> (raw)

Hi,

PaX Team has sent me this patch for inclusion. Basically, during early
boot on x86, the exception handler does not make a special case for
exceptions which push an error code onto the stack, leading to a return
to a wrong address. Two patches were proposed, one which would add a
special case for all exceptions using the return code, and this one. The
former was of no use in its form because the return from the exception
handler would get back to the faulting exception, causing it to loop.

This one should be better as it effectively hangs the system using HLT
to prevent CPU from burning.

If nobody has any objections, I will merge it. In this case, I would also
like someone to check if 2.6 needs it and to port it in this case.

Thanks,
Willy

--

fix the longest existing kernel bug ever (since 0.01 ;-). basically,
the dummy interrupt handler installed for the early boot period does
not work for exceptions that push an error code as well, effectively
making the iret at the end of the handler to trigger another exception,
ad infinitum, or rather, until the kernel stack runs over, trashes all
memory below and eventually causes a CPU reset or a hang. without this
fix the early printk facility in 2.6 is also rather useless.


diff -Nurp linux-2.4.33/arch/i386/kernel/head.S linux-2.4.33-early-
inthandler/arch/i386/kernel/head.S
--- linux-2.4.33/arch/i386/kernel/head.S	2003-11-28 19:26:19.000000000 +0100
+++ linux-2.4.33-early-inthandler/arch/i386/kernel/head.S	2006-08-29 
14:19:55.000000000 +0200
@@ -325,27 +325,21 @@ ENTRY(stack_start)
 
 /* This is the default interrupt "handler" :-) */
 int_msg:
-	.asciz "Unknown interrupt\n"
+	.asciz "Unknown interrupt, stack: %p %p %p %p\n"
 	ALIGN
 ignore_int:
 	cld
-	pushl %eax
-	pushl %ecx
-	pushl %edx
-	pushl %es
-	pushl %ds
 	movl $(__KERNEL_DS),%eax
 	movl %eax,%ds
 	movl %eax,%es
+	pushl 12(%esp)
+	pushl 12(%esp)
+	pushl 12(%esp)
+	pushl 12(%esp)
 	pushl $int_msg
 	call SYMBOL_NAME(printk)
-	popl %eax
-	popl %ds
-	popl %es
-	popl %edx
-	popl %ecx
-	popl %eax
-	iret
+1:	hlt
+	jmp 1b
 
 /*
  * The interrupt descriptor table has room for 256 idt's,


             reply	other threads:[~2006-08-30  6:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30  6:39 Willy Tarreau [this message]
2006-08-30  9:51 ` [PATCH][RFC] exception processing in early boot Andi Kleen
2006-08-30 12:18   ` Willy Tarreau
2006-08-30 12:59     ` Andi Kleen
2006-08-30 13:16       ` Willy Tarreau
     [not found]         ` <20060830100015.6b967c32.seanlkml@sympatico.ca>
2006-08-30 13:46           ` Willy Tarreau
2006-08-30 14:00           ` Sean
     [not found]       ` <44F5D81A.9650.5BE48F99@pageexec.freemail.hu>
2006-08-30 16:30         ` Andi Kleen
2006-08-30 16:59           ` linux-os (Dick Johnson)
2006-08-30 17:02             ` Andi Kleen
2006-08-30 17:15               ` linux-os (Dick Johnson)
     [not found]           ` <44F5E818.20898.5C230A79@pageexec.freemail.hu>
2006-08-30 17:52             ` Andi Kleen
     [not found]               ` <44F5F348.1251.5C4EBCCB@pageexec.freemail.hu>
2006-08-30 18:26                 ` Andi Kleen
2006-08-30 19:01                   ` Willy Tarreau
2006-08-30 19:36                     ` Andi Kleen
2006-08-30 20:03                       ` Willy Tarreau
2006-08-30 20:06                         ` Andi Kleen
2006-08-30 20:40                           ` Willy Tarreau
2006-08-30 21:31                         ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2006-08-31  2:05 Chuck Ebbert

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=20060830063932.GB289@1wt.eu \
    --to=w@1wt.eu \
    --cc=Riley@Williams.Name \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pageexec@freemail.hu \
    /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