2017-11-24 15:00:32 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2006-07-03 00:24:41 -07:00
|
|
|
/*
|
|
|
|
* Stack trace management functions
|
|
|
|
*
|
2012-07-20 11:15:04 +02:00
|
|
|
* Copyright IBM Corp. 2006
|
2006-07-03 00:24:41 -07:00
|
|
|
*/
|
|
|
|
|
2024-04-29 14:28:44 +02:00
|
|
|
#include <linux/perf_event.h>
|
2006-07-03 00:24:41 -07:00
|
|
|
#include <linux/stacktrace.h>
|
2023-10-30 16:50:47 +01:00
|
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <linux/compat.h>
|
2025-03-21 13:22:14 +01:00
|
|
|
#include <asm/asm-offsets.h>
|
2019-01-28 08:33:08 +01:00
|
|
|
#include <asm/stacktrace.h>
|
|
|
|
#include <asm/unwind.h>
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
#include <asm/kprobes.h>
|
2023-10-30 16:50:47 +01:00
|
|
|
#include <asm/ptrace.h>
|
2016-02-01 14:14:04 +01:00
|
|
|
|
2019-08-14 14:27:44 +02:00
|
|
|
void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
|
|
|
|
struct task_struct *task, struct pt_regs *regs)
|
2016-02-01 14:14:04 +01:00
|
|
|
{
|
2019-01-28 08:33:08 +01:00
|
|
|
struct unwind_state state;
|
2019-08-14 14:27:44 +02:00
|
|
|
unsigned long addr;
|
2016-02-01 14:14:04 +01:00
|
|
|
|
2019-08-14 14:27:44 +02:00
|
|
|
unwind_for_each_frame(&state, task, regs, 0) {
|
|
|
|
addr = unwind_get_return_address(&state);
|
2020-09-14 16:34:07 +01:00
|
|
|
if (!addr || !consume_entry(cookie, addr))
|
2019-01-28 08:33:08 +01:00
|
|
|
break;
|
|
|
|
}
|
2008-02-05 16:50:45 +01:00
|
|
|
}
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
|
|
|
|
int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
|
|
|
|
void *cookie, struct task_struct *task)
|
|
|
|
{
|
|
|
|
struct unwind_state state;
|
|
|
|
unsigned long addr;
|
|
|
|
|
|
|
|
unwind_for_each_frame(&state, task, NULL, 0) {
|
|
|
|
if (state.stack_info.type != STACK_TYPE_TASK)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (state.regs)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
addr = unwind_get_return_address(&state);
|
|
|
|
if (!addr)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2023-01-17 14:37:10 +01:00
|
|
|
#ifdef CONFIG_RETHOOK
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
/*
|
2023-01-17 14:37:10 +01:00
|
|
|
* Mark stacktraces with krethook functions on them
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
* as unreliable.
|
|
|
|
*/
|
2023-01-17 14:37:10 +01:00
|
|
|
if (state.ip == (unsigned long)arch_rethook_trampoline)
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
return -EINVAL;
|
|
|
|
#endif
|
|
|
|
|
2020-09-14 16:34:07 +01:00
|
|
|
if (!consume_entry(cookie, addr))
|
s390/livepatch: Implement reliable stack tracing for the consistency model
The livepatch consistency model requires reliable stack tracing
architecture support in order to work properly. In order to achieve
this, two main issues have to be solved. First, reliable and consistent
call chain backtracing has to be ensured. Second, the unwinder needs to
be able to detect stack corruptions and return errors.
The "zSeries ELF Application Binary Interface Supplement" says:
"The stack pointer points to the first word of the lowest allocated
stack frame. If the "back chain" is implemented this word will point to
the previously allocated stack frame (towards higher addresses), except
for the first stack frame, which shall have a back chain of zero (NULL).
The stack shall grow downwards, in other words towards lower addresses."
"back chain" is optional. GCC option -mbackchain enables it. Quoting
Martin Schwidefsky [1]:
"The compiler is called with the -mbackchain option, all normal C
function will store the backchain in the function prologue. All
functions written in assembler code should do the same, if you find one
that does not we should fix that. The end result is that a task that
*voluntarily* called schedule() should have a proper backchain at all
times.
Dependent on the use case this may or may not be enough. Asynchronous
interrupts may stop the CPU at the beginning of a function, if kernel
preemption is enabled we can end up with a broken backchain. The
production kernels for IBM Z are all compiled *without* kernel
preemption. So yes, we might get away without the objtool support.
On a side-note, we do have a line item to implement the ORC unwinder for
the kernel, that includes the objtool support. Once we have that we can
drop the -mbackchain option for the kernel build. That gives us a nice
little performance benefit. I hope that the change from backchain to the
ORC unwinder will not be too hard to implement in the livepatch tools."
Since -mbackchain is enabled by default when the kernel is compiled, the
call chain backtracing should be currently ensured and objtool should
not be necessary for livepatch purposes.
Regarding the second issue, stack corruptions and non-reliable states
have to be recognized by the unwinder. Mainly it means to detect
preemption or page faults, the end of the task stack must be reached,
return addresses must be valid text addresses and hacks like function
graph tracing and kretprobes must be properly detected.
Unwinding a running task's stack is not a problem, because there is a
livepatch requirement that every checked task is blocked, except for the
current task. Due to that, the implementation can be much simpler
compared to the existing non-reliable infrastructure. We can consider a
task's kernel/thread stack only and skip the other stacks.
[1] 20180912121106.31ffa97c@mschwideX1 [not archived on lore.kernel.org]
Link: https://lkml.kernel.org/r/20191106095601.29986-5-mbenes@suse.cz
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2019-11-06 10:56:01 +01:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for stack corruption */
|
|
|
|
if (unwind_error(&state))
|
|
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
|
|
}
|
2023-10-30 16:50:47 +01:00
|
|
|
|
2024-04-29 14:28:44 +02:00
|
|
|
static inline bool store_ip(stack_trace_consume_fn consume_entry, void *cookie,
|
|
|
|
struct perf_callchain_entry_ctx *entry, bool perf,
|
|
|
|
unsigned long ip)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_PERF_EVENTS
|
|
|
|
if (perf) {
|
|
|
|
if (perf_callchain_store(entry, ip))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return consume_entry(cookie, ip);
|
|
|
|
}
|
|
|
|
|
2024-04-29 14:28:46 +02:00
|
|
|
static inline bool ip_invalid(unsigned long ip)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Perform some basic checks if an instruction address taken
|
|
|
|
* from unreliable source is invalid.
|
|
|
|
*/
|
|
|
|
if (ip & 1)
|
|
|
|
return true;
|
|
|
|
if (ip < mmap_min_addr)
|
|
|
|
return true;
|
|
|
|
if (ip >= current->mm->context.asce_limit)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-04-29 14:28:48 +02:00
|
|
|
static inline bool ip_within_vdso(unsigned long ip)
|
|
|
|
{
|
|
|
|
return in_range(ip, current->mm->context.vdso_base, vdso_text_size());
|
|
|
|
}
|
|
|
|
|
2024-04-29 14:28:44 +02:00
|
|
|
void arch_stack_walk_user_common(stack_trace_consume_fn consume_entry, void *cookie,
|
|
|
|
struct perf_callchain_entry_ctx *entry,
|
|
|
|
const struct pt_regs *regs, bool perf)
|
2023-10-30 16:50:47 +01:00
|
|
|
{
|
2024-04-29 14:28:48 +02:00
|
|
|
struct stack_frame_vdso_wrapper __user *sf_vdso;
|
2023-10-30 16:50:47 +01:00
|
|
|
struct stack_frame_user __user *sf;
|
|
|
|
unsigned long ip, sp;
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
if (is_compat_task())
|
|
|
|
return;
|
2024-04-29 14:28:46 +02:00
|
|
|
if (!current->mm)
|
|
|
|
return;
|
2024-04-29 14:28:44 +02:00
|
|
|
ip = instruction_pointer(regs);
|
|
|
|
if (!store_ip(consume_entry, cookie, entry, perf, ip))
|
2023-10-30 16:50:47 +01:00
|
|
|
return;
|
|
|
|
sf = (void __user *)user_stack_pointer(regs);
|
|
|
|
pagefault_disable();
|
|
|
|
while (1) {
|
|
|
|
if (__get_user(sp, &sf->back_chain))
|
|
|
|
break;
|
2024-04-29 14:28:48 +02:00
|
|
|
/*
|
|
|
|
* VDSO entry code has a non-standard stack frame layout.
|
|
|
|
* See VDSO user wrapper code for details.
|
|
|
|
*/
|
|
|
|
if (!sp && ip_within_vdso(ip)) {
|
|
|
|
sf_vdso = (void __user *)sf;
|
|
|
|
if (__get_user(ip, &sf_vdso->return_address))
|
|
|
|
break;
|
|
|
|
sp = (unsigned long)sf + STACK_FRAME_VDSO_OVERHEAD;
|
|
|
|
sf = (void __user *)sp;
|
|
|
|
if (__get_user(sp, &sf->back_chain))
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
sf = (void __user *)sp;
|
|
|
|
if (__get_user(ip, &sf->gprs[8]))
|
|
|
|
break;
|
|
|
|
}
|
2024-04-29 14:28:45 +02:00
|
|
|
/* Sanity check: ABI requires SP to be 8 byte aligned. */
|
2024-04-29 14:28:48 +02:00
|
|
|
if (sp & 0x7)
|
2023-10-30 16:50:47 +01:00
|
|
|
break;
|
2024-04-29 14:28:46 +02:00
|
|
|
if (ip_invalid(ip)) {
|
2023-10-30 16:50:47 +01:00
|
|
|
/*
|
|
|
|
* If the instruction address is invalid, and this
|
|
|
|
* is the first stack frame, assume r14 has not
|
|
|
|
* been written to the stack yet. Otherwise exit.
|
|
|
|
*/
|
2024-04-29 14:28:46 +02:00
|
|
|
if (!first)
|
|
|
|
break;
|
|
|
|
ip = regs->gprs[14];
|
|
|
|
if (ip_invalid(ip))
|
2023-10-30 16:50:47 +01:00
|
|
|
break;
|
|
|
|
}
|
2024-04-29 14:28:44 +02:00
|
|
|
if (!store_ip(consume_entry, cookie, entry, perf, ip))
|
2024-11-18 13:14:07 +01:00
|
|
|
break;
|
2023-10-30 16:50:47 +01:00
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
pagefault_enable();
|
|
|
|
}
|
2024-04-26 12:02:15 +02:00
|
|
|
|
2024-04-29 14:28:44 +02:00
|
|
|
void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
|
|
|
|
const struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
arch_stack_walk_user_common(consume_entry, cookie, NULL, regs, false);
|
|
|
|
}
|