From: tsbogend@alpha.franken.de (Thomas Bogendoerfer)
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: Breakage in arch/mips/kernel/traps.c for 64bit
Date: Sun, 4 May 2008 00:48:49 +0200 [thread overview]
Message-ID: <20080503224849.GA2314@alpha.franken.de> (raw)
In-Reply-To: <20080504.011647.93019265.anemo@mba.ocn.ne.jp>
On Sun, May 04, 2008 at 01:16:47AM +0900, Atsushi Nemoto wrote:
> On Fri, 2 May 2008 11:11:13 +0100, Ralf Baechle <ralf@linux-mips.org> wrote:
> > It came as part of 39b8d5254246ac56342b72f812255c8f7a74dca9 which is a
> > patch amalgated from several other patches. Below is the original patch
> > it came with. I think the idea of the patch is valid but the idea needs a
> > bit of mending.
>
> Then how about this fix?
hmm, why not simply use __get_user() when accessing the stack content ?
show_stacktrace() already does it for stack dumping ? This would
avoid any work for whatever sick stack mappings. Below is a patch,
which does this.
Thomas.
The newly added check for valid stack pointer address breaks at least for
64bit kernels. Use __get_user() for accessing stack content to avoid crashes,
when doing the backtrace.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/kernel/traps.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index cb8b0e2..c9ce8d6 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -81,22 +81,22 @@ void (*board_bind_eic_interrupt)(int irq, int regset);
static void show_raw_backtrace(unsigned long reg29)
{
- unsigned long *sp = (unsigned long *)(reg29 & ~3);
+ unsigned long __user *sp = (unsigned long __user *)(reg29 & ~3);
unsigned long addr;
printk("Call Trace:");
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
-#define IS_KVA01(a) ((((unsigned int)a) & 0xc0000000) == 0x80000000)
- if (IS_KVA01(sp)) {
- while (!kstack_end(sp)) {
- addr = *sp++;
- if (__kernel_text_address(addr))
- print_ip_sym(addr);
+ while (!kstack_end(sp)) {
+ if (__get_user(addr, sp++)) {
+ printk(" (Bad stack address)");
+ break;
}
- printk("\n");
+ if (__kernel_text_address(addr))
+ print_ip_sym(addr);
}
+ printk("\n");
}
#ifdef CONFIG_KALLSYMS
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2008-05-03 22:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-01 16:33 Breakage in arch/mips/kernel/traps.c for 64bit Thomas Bogendoerfer
2008-05-01 21:01 ` Maciej W. Rozycki
2008-05-02 10:11 ` Ralf Baechle
2008-05-03 16:16 ` Atsushi Nemoto
2008-05-03 17:39 ` Ralf Baechle
2008-05-03 19:57 ` Maciej W. Rozycki
2008-05-03 22:48 ` Thomas Bogendoerfer [this message]
2008-05-04 13:39 ` Atsushi Nemoto
2008-05-04 22:08 ` Thomas Bogendoerfer
2008-05-05 14:58 ` Atsushi Nemoto
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=20080503224849.GA2314@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=anemo@mba.ocn.ne.jp \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/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