@@ -81,23 +81,19 @@ NOKPROBE_SYMBOL(unwind_init);
* records (e.g. a cycle), determined based on the location and fp value of A
* and the location (but not the fp value) of B.
*/
-static int notrace unwind_next(struct task_struct *tsk,
- struct unwind_state *state)
+static int notrace __unwind_next(struct task_struct *tsk,
+ struct unwind_state *state,
+ struct stack_info *info)
{
unsigned long fp = state->fp;
- struct stack_info info;
-
- /* Final frame; nothing to unwind */
- if (fp == (unsigned long)task_pt_regs(tsk)->stackframe)
- return -ENOENT;
if (fp & 0x7)
return -EINVAL;
- if (!on_accessible_stack(tsk, fp, 16, &info))
+ if (!on_accessible_stack(tsk, fp, 16, info))
return -EINVAL;
- if (test_bit(info.type, state->stacks_done))
+ if (test_bit(info->type, state->stacks_done))
return -EINVAL;
/*
@@ -113,7 +109,7 @@ static int notrace unwind_next(struct task_struct *tsk,
* stack to another, it's never valid to unwind back to that first
* stack.
*/
- if (info.type == state->prev_type) {
+ if (info->type == state->prev_type) {
if (fp <= state->prev_fp)
return -EINVAL;
} else {
@@ -127,7 +123,25 @@ static int notrace unwind_next(struct task_struct *tsk,
state->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
state->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8));
state->prev_fp = fp;
- state->prev_type = info.type;
+ state->prev_type = info->type;
+
+ return 0;
+}
+NOKPROBE_SYMBOL(__unwind_next);
+
+static int notrace unwind_next(struct task_struct *tsk,
+ struct unwind_state *state)
+{
+ struct stack_info info;
+ int err;
+
+ /* Final frame; nothing to unwind */
+ if (state->fp == (unsigned long)task_pt_regs(tsk)->stackframe)
+ return -ENOENT;
+
+ err = __unwind_next(tsk, state, &info);
+ if (err)
+ return err;
state->pc = ptrauth_strip_insn_pac(state->pc);