From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Avi Kivity <avi@qumranet.com>
Subject: Re: [git pull] core, x86: make LIST_POISON less deadly
Date: Mon, 14 Jul 2008 12:30:04 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0807141214180.3305@woody.linux-foundation.org> (raw)
In-Reply-To: <487BA4CF.6060905@firstfloor.org>
On Mon, 14 Jul 2008, Andi Kleen wrote:
>
> How about if the page fault handler checks for the value and prints
> a obvious string? It could do this reliably, unlike the "grep
> all registers for poison on #GP" method that was earlier proposed.
The GP handler, you mean.
Sure, that might work. I'm not convinced it's worth it, but it's certainly
not difficult to do either. Something like this (TOTALLY UNTESTED!) might
work.
It puts it in the general "__die()" routine because it was easier this way
(we do want it below the "oops" thing, so that it gets captured by Arjan's
scripts!), in case the deathnotes are useful for other cases too.
It could perhaps be extended to allow negative offsets off the 0xdead000..
pointer (right now those would be ignored because the '0xdead00..' part
would turns into '0xdeacff..') but that would not matter for the
particular case of the list poisoning (since that one adds the 0x0100100
thing to it anyway).
Again: totally untested.
Linus
---
arch/x86/kernel/traps_64.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index f1a95d1..7487ce2 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -434,6 +434,29 @@ void dump_stack(void)
EXPORT_SYMBOL(dump_stack);
+/*
+ * This depends intimately on the layout of pt_regs to
+ * show deathnotes in the GP registers.
+ */
+static void show_deathnotes(struct pt_regs *regs)
+{
+ static const char *names[16] = {
+ "r15", "r14", "r13", "r12",
+ "rbp", "rbx", "r11", "r10",
+ "r9", "r8", "rax", "rcx",
+ "rdx", "rsi", "rdi",
+ };
+ const unsigned long *r = ®s->r15;
+ int i;
+
+ for (i = 0; i < 15; i++) {
+ unsigned long value = r[i];
+ if ((value >> 48) != 0xdead)
+ continue;
+ printk("Deathnote %lx in register %s\n", value, names[i]);
+ }
+}
+
void show_registers(struct pt_regs *regs)
{
int i;
@@ -554,6 +577,7 @@ int __kprobes __die(const char * str, struct pt_regs * regs, long err)
printk("\n");
if (notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
return 1;
+ show_deathnotes(regs);
show_registers(regs);
add_taint(TAINT_DIE);
/* Executive summary in case the oops scrolled away */
next prev parent reply other threads:[~2008-07-14 19:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 14:48 Ingo Molnar
2008-07-14 15:03 ` Linus Torvalds
2008-07-14 15:12 ` Ingo Molnar
2008-07-14 15:53 ` Avi Kivity
2008-07-14 15:59 ` Linus Torvalds
2008-07-14 16:07 ` Ingo Molnar
2008-07-14 16:08 ` Avi Kivity
2008-07-14 16:26 ` Linus Torvalds
2008-07-14 16:34 ` Ingo Molnar
2008-07-14 18:33 ` Andi Kleen
2008-07-14 18:42 ` Linus Torvalds
2008-07-14 19:11 ` Andi Kleen
2008-07-14 19:30 ` Linus Torvalds [this message]
2008-07-14 19:42 ` Andi Kleen
2008-07-14 18:35 ` Andi Kleen
2008-07-14 18:42 ` Linus Torvalds
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=alpine.LFD.1.10.0807141214180.3305@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=avi@qumranet.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.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
all inboxes | Powered by JetHome®