diff options
author | Vasily Gorbik | 2019-11-27 18:12:04 +0100 |
---|---|---|
committer | Vasily Gorbik | 2019-11-30 10:52:48 +0100 |
commit | bf018ee644897d7982e1b8dd8b15e97db6e1a4da (patch) | |
tree | 9087630097be11160e564918ac705756de482fd3 /arch/s390 | |
parent | 222ee9087a730b1df08d09baed0d03626e67600f (diff) |
s390/unwind: filter out unreliable bogus %r14
Currently unwinder unconditionally returns %r14 from the first frame
pointed by %r15 from pt_regs. A task could be interrupted when a function
already allocated this frame (if it needs it) for its callees or to
store local variables. In that case this frame would contain random
values from stack or values stored there by a callee. As we are only
interested in %r14 to get potential return address, skip bogus return
addresses which doesn't belong to kernel text.
This helps to avoid duplicating filtering logic in unwider users, most
of which use unwind_get_return_address() and would choke on bogus 0
address returned by it otherwise.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kernel/unwind_bc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/s390/kernel/unwind_bc.c b/arch/s390/kernel/unwind_bc.c index e1371cdf9fa5..ef42d5f77ce7 100644 --- a/arch/s390/kernel/unwind_bc.c +++ b/arch/s390/kernel/unwind_bc.c @@ -57,6 +57,11 @@ bool unwind_next_frame(struct unwind_state *state) ip = READ_ONCE_NOCHECK(sf->gprs[8]); reliable = false; regs = NULL; + if (!__kernel_text_address(ip)) { + /* skip bogus %r14 */ + state->regs = NULL; + return unwind_next_frame(state); + } } else { sf = (struct stack_frame *) state->sp; sp = READ_ONCE_NOCHECK(sf->back_chain); |