]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/unwind: fix fgraph return address recovery
authorSumanth Korikkar <sumanthk@linux.ibm.com>
Tue, 26 Jul 2022 16:57:59 +0000 (18:57 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 28 Jul 2022 16:05:24 +0000 (18:05 +0200)
When HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is defined, the return
address to the fgraph caller is recovered by tagging it along with the
stack pointer of ftrace stack. This makes the stack unwinding more
reliable.

When the fgraph return address is modified to return_to_handler,
ftrace_graph_ret_addr tries to restore it to the original
value using tagged stack pointer.

Fix this by passing tagged sp to ftrace_graph_ret_addr.

Fixes: e12a044c6bbc ("s390/unwind: recover kretprobe modified return address in stacktrace")
Cc: <stable@vger.kernel.org> # 5.18
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/unwind.h

index 0bf06f1682d81363a07db9ea0c324c3400f74727..02462e7100c1cc0a4d51e424652c015e7ae3a78f 100644 (file)
@@ -47,7 +47,7 @@ struct unwind_state {
 static inline unsigned long unwind_recover_ret_addr(struct unwind_state *state,
                                                    unsigned long ip)
 {
-       ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, NULL);
+       ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *)state->sp);
        if (is_kretprobe_trampoline(ip))
                ip = kretprobe_find_ret_addr(state->task, (void *)state->sp, &state->kr_cur);
        return ip;