Skip to content

Commit 87eceb1

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/stacktrace: Skip first user stack frame
When walking user stack frames the first stack frame (where the stack pointer points to) should be skipped: the return address of the current function is saved in the previous stack frame, not the current stack frame, which is allocated for to be called functions. Fixes: aa44433 ("s390: add USER_STACKTRACE support") Reviewed-by: Jens Remus <jremus@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent ebd912f commit 87eceb1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/s390/kernel/stacktrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ void arch_stack_walk_user_common(stack_trace_consume_fn consume_entry, void *coo
9595
while (1) {
9696
if (__get_user(sp, &sf->back_chain))
9797
break;
98+
/* Sanity check: ABI requires SP to be 8 byte aligned. */
99+
if (!sp || sp & 0x7)
100+
break;
101+
sf = (void __user *)sp;
98102
if (__get_user(ip, &sf->gprs[8]))
99103
break;
100104
if (ip & 0x1) {
@@ -110,10 +114,6 @@ void arch_stack_walk_user_common(stack_trace_consume_fn consume_entry, void *coo
110114
}
111115
if (!store_ip(consume_entry, cookie, entry, perf, ip))
112116
return;
113-
/* Sanity check: ABI requires SP to be aligned 8 bytes. */
114-
if (!sp || sp & 0x7)
115-
break;
116-
sf = (void __user *)sp;
117117
first = false;
118118
}
119119
pagefault_enable();

0 commit comments

Comments
 (0)