@@ -339,3 +339,27 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
unwind(&state);
}
+
+/*
+ * arch_stack_walk_reliable() may not be used for livepatch until all of
+ * the reliability checks are in place in unwind_consume(). However,
+ * debug and test code can choose to use it even if all the checks are not
+ * in place.
+ */
+noinline int notrace arch_stack_walk_reliable(stack_trace_consume_fn consume_fn,
+ void *cookie,
+ struct task_struct *task)
+{
+ struct unwind_state state;
+ bool reliable;
+
+ unwind_init_common(&state, task, NULL, consume_fn, cookie);
+
+ if (task == current)
+ unwind_init_current(&state);
+ else
+ unwind_init_task(&state);
+
+ reliable = unwind(&state);
+ return reliable ? 0 : -EINVAL;
+}