diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2011-06-29 00:48:19 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2016-06-04 22:05:07 +0200 |
commit | be24a89700eef61bedaba40f3b05ef07f5806e38 (patch) | |
tree | 818288f6657c04b9d2ec91f1572ab78c49ef7bb8 /arch/parisc/kernel/processor.c | |
parent | 049ec1b5a76d34a6980cccdb7c0baeb4eed7a993 (diff) | |
download | linux-stable-be24a89700eef61bedaba40f3b05ef07f5806e38.tar.gz linux-stable-be24a89700eef61bedaba40f3b05ef07f5806e38.tar.bz2 linux-stable-be24a89700eef61bedaba40f3b05ef07f5806e38.zip |
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>
Diffstat (limited to 'arch/parisc/kernel/processor.c')
0 files changed, 0 insertions, 0 deletions