linux-stable/arch/parisc/kernel
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
..
.gitignore
Makefile parisc: Fix ftrace function tracer 2016-04-14 17:47:19 +02:00
asm-offsets.c parisc: Unbreak handling exceptions from kernel modules 2016-04-08 22:14:14 +02:00
audit.c parisc: add kernel audit feature 2013-11-07 22:27:20 +01:00
binfmt_elf32.c parisc: fix redefinition of SET_PERSONALITY 2013-03-02 20:15:28 +01:00
cache.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
compat_audit.c parisc: add kernel audit feature 2013-11-07 22:27:20 +01:00
drivers.c parisc: convert to dma_map_ops 2016-01-20 17:09:18 -08:00
entry.S parisc: Use long jump to reach ftrace_return_to_handler() 2016-05-23 23:44:44 +02:00
firmware.c parisc: delete __cpuinit usage from all users 2013-07-14 19:36:51 -04:00
ftrace.c parisc: Merge ftrace C-helper and assembler functions into .text.hot section 2016-05-22 21:46:21 +02:00
hardware.c parisc: add serial ports of C8000/1GHz machine to hardware database 2014-07-13 15:51:58 +02:00
head.S parisc: Fix ftrace function tracer 2016-04-14 17:47:19 +02:00
hpmc.S parisc: fix partly 16/64k PAGE_SIZE boot 2013-05-06 23:08:32 +02:00
inventory.c parisc: Fix interrupt routing for C8000 serial ports 2013-07-31 23:42:32 +02:00
irq.c parisc: Filter out spurious interrupts in PA-RISC irq handler 2015-09-08 15:31:16 +02:00
module.c parisc: Handle R_PARISC_PCREL32 relocations in kernel modules 2016-04-08 22:10:35 +02:00
pa7300lc.c
pacache.S parisc: Use unshadowed index register for flush instructions in flush_dcache_page_asm and flush_icache_page_asm 2013-06-18 20:29:10 +02:00
parisc_ksyms.c parisc: Avoid function pointers for kernel exception routines 2016-04-08 22:13:45 +02:00
pci-dma.c parisc: convert to dma_map_ops 2016-01-20 17:09:18 -08:00
pci.c parisc: Initialize PCI bridge cache line and default latency 2016-01-12 22:03:21 +01:00
pdc_chassis.c parisc: single_open() leaks 2013-05-05 00:10:41 -04:00
pdc_cons.c parisc: don't use module_init for non-modular core pdc_cons code 2015-06-16 14:12:30 -04:00
perf.c parisc64: don't use module_init for non-modular core perf code 2015-06-16 14:12:30 -04:00
perf_asm.S
perf_images.h
process.c exit_thread: remove empty bodies 2016-05-20 17:58:30 -07:00
processor.c parisc: Reduce overhead of parisc_requires_coherency() 2016-01-12 22:03:36 +01:00
ptrace.c parisc: Add ARCH_TRACEHOOK and regset support 2016-05-22 21:39:13 +02:00
real2.S
setup.c parisc: Add Huge Page and HUGETLBFS support 2015-11-22 12:23:10 +01:00
signal.c parisc: Fix syscall restarts 2015-12-21 10:16:18 +01:00
signal32.c parisc: Fix SIGSYS signals in compat case 2016-03-31 12:28:37 +02:00
signal32.h constify copy_siginfo_to_user{,32}() 2013-11-09 00:16:29 -05:00
smp.c arch/hotplug: Call into idle with a proper state 2016-03-01 20:36:57 +01:00
stacktrace.c
sys_parisc.c parisc: Drop alloc_hugepages and free_hugepages syscalls 2016-03-23 15:42:18 +01:00
sys_parisc32.c parisc: drop unused defines and header includes 2014-07-13 15:56:12 +02:00
syscall.S parisc: Add syscall tracepoint support 2016-05-22 21:38:47 +02:00
syscall_table.S parisc: Wire up preadv2 and pwritev2 syscalls 2016-03-23 16:22:42 +01:00
time.c parisc: Add native high-resolution sched_clock() implementation 2016-05-22 21:39:25 +02:00
topology.c
traps.c parisc: Fix kernel crash with reversed copy_from_user() 2016-04-08 22:14:04 +02:00
unaligned.c parisc: show number of FPE and unaligned access handler calls in /proc/interrupts 2013-05-24 22:35:26 +02:00
unwind.c parisc: Fix backtrace on PA-RISC 2016-06-04 22:05:07 +02:00
vmlinux.lds.S arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections 2016-03-25 16:37:42 -07:00