Skip to content

Commit 708b137

Browse files
author
Vasily Gorbik
committed
s390/unwind: avoid duplicated unwinding entries for kretprobes
Currently when unwinding starts from pt_regs or encounters pt_regs along the way unwinder tries to yield 2 unwinding entries: 1. (reliable) ip1: pt_regs->psw.addr, sp1: regs->gprs[15] 2. (non-reliable) ip2: sp1->gprs[8] (r14), sp2: regs->gprs[15] In case of kretprobes those are identical and serves no other purpose than causing confusion over duplicated entries and cause kprobes tests to fail. So, skip a duplicate non-reliable entry in this case. With that kretprobes and unwinder implementation now comply with ARCH_CORRECT_STACKTRACE_ON_KRETPROBE. Reviewed-by: Tobias Huschle <huschle@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent d81675b commit 708b137

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ config S390
5858
select ALTERNATE_USER_ADDRESS_SPACE
5959
select ARCH_32BIT_USTAT_F_TINODE
6060
select ARCH_BINFMT_ELF_STATE
61+
select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
6162
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
6263
select ARCH_ENABLE_MEMORY_HOTREMOVE
6364
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2

arch/s390/kernel/unwind_bc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ bool unwind_next_frame(struct unwind_state *state)
6464
ip = READ_ONCE_NOCHECK(sf->gprs[8]);
6565
reliable = false;
6666
regs = NULL;
67-
if (!__kernel_text_address(ip)) {
68-
/* skip bogus %r14 */
67+
/* skip bogus %r14 or if is the same as regs->psw.addr */
68+
if (!__kernel_text_address(ip) || state->ip == unwind_recover_ret_addr(state, ip)) {
6969
state->regs = NULL;
7070
return unwind_next_frame(state);
7171
}

0 commit comments

Comments
 (0)