path: root/arch/parisc/kernel/unwind.c
AgeCommit message (Collapse)Author
2016-06-04parisc: Fix backtrace on PA-RISCMikulas Patocka
This patch fixes backtrace on PA-RISC There were several problems: 1) The code that decodes instructions handles instructions that subtract from the stack pointer incorrectly. If the instruction subtracts the number X from the stack pointer the code increases the frame size by (0x100000000-X). This results in invalid accesses to memory and recursive page faults. 2) Because gcc reorders blocks, handling instructions that subtract from the frame pointer is incorrect. For example, this function int f(int a) { if (__builtin_expect(a, 1)) return a; g(); return a; } is compiled in such a way, that the code that decreases the stack pointer for the first "return a" is placed before the code for "g" call. If we recognize this decrement, we mistakenly believe that the frame size for the "g" call is zero. To fix problems 1) and 2), the patch doesn't recognize instructions that decrease the stack pointer at all. To further safeguard the unwind code against nonsense values, we don't allow frame size larger than Total_frame_size. 3) The backtrace is not locked. If stack dump races with module unload, invalid table can be accessed. This patch adds a spinlock when processing module tables. Note, that for correct backtrace, you need recent binutils. Binutils 2.18 from Debian 5 produce garbage unwind tables. Binutils 2.21 work better (it sometimes forgets function frames, but at least it doesn't generate garbage). Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de>
2013-11-30parisc: use kernel_text_address() in unwind functionsHelge Deller
Signed-off-by: Helge Deller <deller@gmx.de>
2010-10-21parisc: unwind - optimise linked-list searches for modulesPhil Carmody
Having many dozens of modules, the searches down the linked list of sections would dominate the lookup time, dwarfing any savings from the binary search within the section. A simple move-to-front optimisation exploits the commonality of the code paths taken, and in simple real-world tests on other architectures reduced the number of steps in the search to barely more than 1. Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Kyle McMartin <kyle@redhat.com>
2009-12-16parisc: use sort() instead of home-made implementation (v2)Helge Deller
Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Randolph Chung <tausq@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2009-12-16parisc: add CALLER_ADDR{0-6} macrosHelge Deller
Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2009-11-30parisc: fix unwind with recent gcc versionsHelge Deller
kernel unwinding is broken with gcc >= 4.x. Part of the problem is that binutils seems very sensitive to where the unwind information is stored. Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-05parisc: fix GFP_KERNEL use while atomic in unwinderHelge Deller
Since unwind_frame_init_from_blocked_task() may be called from interrupt/in_atomic context, it needs to kmalloc() memory with GFP_ATOMIC instead of GFP_KERNEL. This fixes this warning (ShowTasks called from sysrq handler): BUG: sleeping function called from invalid context at mm/slab.c:3044 in_atomic(): 1, irqs_disabled(): 1, pid: 2119, name: miniruby Backtrace: [<10132e78>] __might_sleep+0x4c/0x118 [<1018f644>] kmem_cache_alloc+0x2c/0xb4 [<1011bae0>] unwind_frame_init_from_blocked_task+0x30/0xa0 [<1010fd3c>] parisc_show_stack+0x3c/0xac [<10132c7c>] show_state_filter+0x80/0xd8 [<102f4074>] __handle_sysrq+0xd0/0x1b0 [<102f9558>] receive_chars+0x22c/0x318 [<102f9940>] serial8250_handle_port+0x40/0x88 [<102f9a8c>] serial8250_interrupt+0x104/0x10c [<10161920>] handle_IRQ_event+0x44/0x94 [<10161acc>] __do_IRQ+0x15c/0x1dc [<102c442c>] superio_interrupt+0x74/0xa8 [<10161920>] handle_IRQ_event+0x44/0x94 [<10161acc>] __do_IRQ+0x15c/0x1dc [<10110fb4>] do_cpu_irq_mask+0x90/0xbc [<10114068>] intr_return+0x0/0x4 Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2008-10-10parisc: initialize unwinder much earlierJames Bottomley
The unwinder was being initialized way too late to be any use debugging early boot crashes. Instead of relying on module_init initcalls to initialize it, let's do it explicitly as early as we can. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2007-10-18[PARISC] Kill incorrect cast warning in unwinderKyle McMartin
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
2007-07-17kallsyms: make KSYM_NAME_LEN include space for trailing '\0'Tejun Heo
KSYM_NAME_LEN is peculiar in that it does not include the space for the trailing '\0', forcing all users to use KSYM_NAME_LEN + 1 when allocating buffer. This is nonsense and error-prone. Moreover, when the caller forgets that it's very likely to subtly bite back by corrupting the stack because the last position of the buffer is always cleared to zero. This patch increments KSYM_NAME_LEN by one and updates code accordingly. * off-by-one bug in asm-powerpc/kprobes.h::kprobe_lookup_name() macro is fixed. * Where MODULE_NAME_LEN and KSYM_NAME_LEN were used together, MODULE_NAME_LEN was treated as if it didn't include space for the trailing '\0'. Fix it. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Paulo Marques <pmarques@grupopie.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-21[PARISC] unwinder improvementsRandolph Chung
Add special-case handling for "handle_interruption" so that we can rewind past the interruption. This is useful for seeing what caused a BUG() or WARN_ON(); otherwise the unwind stops at the interruption. Signed-off-by: Randolph Chung <tausq@debian.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2007-06-21[PARISC] Fix unwinder on 64-bit kernelsRandolph Chung
The unwinder was broken by the shift of PAGE_OFFSET in order to increase the size of the vmalloc area on 64-bit kernels. Signed-off-by: Randolph Chung <tausq@debian.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2007-05-30[PARISC] fix null ptr deref in unwind.cKyle McMartin
commit ffb45122766db220d0bf3d01848d575fbbcb6430 removed one too many args. kallsyms_lookup is not safe to call with a NULL *modname. Paper bag over the problem for the time being. Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2007-05-08Simplify kallsyms_lookup()Alexey Dobriyan
Several kallsyms_lookup() pass dummy arguments but only need, say, module's name. Make kallsyms_lookup() accept NULLs where possible. Also, makes picture clearer about what interfaces are needed for all symbol resolving business. Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Cc: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-17[PARISC] Remove sched.h from uaccess.h on pariscMatthew Wilcox
Al Viro did this for x86-64 and reduced the number of dependencies on sched.h significantly. We had a couple of files which were relying on uaccess.h pulling in sched.h, so they need explicit dependencies added. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-12-13[PATCH] getting rid of all casts of k[cmz]alloc() callsRobert P. J. Day
Run this: #!/bin/sh for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do echo "De-casting $f..." perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f done And then go through and reinstate those cases where code is casting pointers to non-pointers. And then drop a few hunks which conflicted with outstanding work. Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Greg KH <greg@kroah.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Paul Fulghum <paulkf@microgate.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Karsten Keil <kkeil@suse.de> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: Jeff Garzik <jeff@garzik.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Ian Kent <raven@themaw.net> Cc: Steven French <sfrench@us.ibm.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-01-10[PARISC] Add __read_mostly section for pariscHelge Deller
Flag a whole bunch of things as __read_mostly on parisc. Also flag a few branches as unlikely() and cleanup a bit of code. Signed-off-by: Helge Deller <deller@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!