linux-stable/arch/parisc
Mikulas Patocka be24a89700 parisc: Fix backtrace on PA-RISC
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>
2016-06-04 22:05:07 +02:00
..
configs KEYS: CONFIG_KEYS_DEBUG_PROC_KEYS is no longer an option 2016-02-10 10:13:27 +00:00
include parisc: Whitespace cleanups in unistd.h 2016-05-25 15:40:49 +02:00
kernel parisc: Fix backtrace on PA-RISC 2016-06-04 22:05:07 +02:00
lib parisc: Add native high-resolution sched_clock() implementation 2016-05-22 21:39:25 +02:00
math-emu parisc: Fix typo in fpudispatch.c 2016-05-22 22:29:07 +02:00
mm parisc: Unbreak handling exceptions from kernel modules 2016-04-08 22:14:14 +02:00
oprofile
Kconfig parisc: Add native high-resolution sched_clock() implementation 2016-05-22 21:39:25 +02:00
Kconfig.debug parisc: Fix ftrace function tracer 2016-04-14 17:47:19 +02:00
Makefile parisc: Fix ftrace function tracer 2016-04-14 17:47:19 +02:00
defpalo.conf parisc: switch to gzip-compressed vmlinuz kernel 2013-07-09 22:09:20 +02:00
install.sh parisc: make "make install" not depend on vmlinux 2013-11-07 22:28:06 +01:00
nm