Re: [PATCH v4 11/39] unwind_user: Add user space unwinding API

Andrii Nakryiko
2025-01-24T17:59:43Z

On Tue, Jan 21, 2025 at 6:32 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> Introduce a generic API for unwinding user stacks.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
> arch/Kconfig | 3 ++
> include/linux/unwind_user.h | 15 ++++++++
> include/linux/unwind_user_types.h | 31 ++++++++++++++++
> kernel/Makefile | 1 +
> kernel/unwind/Makefile | 1 +
> kernel/unwind/user.c | 59 +++++++++++++++++++++++++++++++
> 6 files changed, 110 insertions(+)
> create mode 100644 include/linux/unwind_user.h
> create mode 100644 include/linux/unwind_user_types.h
> create mode 100644 kernel/unwind/Makefile
> create mode 100644 kernel/unwind/user.c
>

[...]

> --- /dev/null
> +++ b/kernel/unwind/user.c
> @@ -0,0 +1,59 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> +* Generic interfaces for unwinding user space
> +*/
> +#include <linux/kernel.h>
> +#include <linux/sched.h>
> +#include <linux/sched/task_stack.h>
> +#include <linux/unwind_user.h>
> +
> +int unwind_user_next(struct unwind_user_state *state)
> +{
> + struct unwind_user_frame _frame;
> + struct unwind_user_frame *frame = &_frame;
> + unsigned long cfa = 0, fp, ra = 0;

wouldn't all the above generate compilation warnings about unused
variables, potentially breaking bisection?

> +
> + /* no implementation yet */
> + -EINVAL;

return missing?

> +} …