Re: [PATCH bpf-next 01/13] uprobes: Rename arch_uretprobe_trampoline function

Andrii Nakryiko
2024-12-13T00:43:10Z

On Wed, Dec 11, 2024 at 5:34 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> We are about to add uprobe trampoline, so cleaning up the namespace.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> arch/x86/kernel/uprobes.c | 2 +-
> include/linux/uprobes.h | 2 +-
> kernel/events/uprobes.c | 4 ++--
> 3 files changed, 4 insertions(+), 4 deletions(-)
>

LGTM

Acked-by: Andrii Nakryiko <andrii@kernel.org>

> diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> index 5a952c5ea66b..22a17c149a55 100644
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c
> @@ -338,7 +338,7 @@ extern u8 uretprobe_trampoline_entry[];
> extern u8 uretprobe_trampoline_end[];
> extern u8 uretprobe_syscall_check[];
>
> -void *arch_uprobe_trampoline(unsigned long *psize)
> +void *arch_uretprobe_trampoline(unsigned long *psize)
> {
> static uprobe_opcode_t insn = UPROBE_SWBP_INSN;
> struct pt_regs *regs = task_pt_regs(current);
> diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
> index e0a4c2082245..09a298e416a8 100644
> --- a/include/linux/uprobes.h
> +++ b/include/linux/uprobes.h
> @@ -211,7 +211,7 @@ extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
> extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
> void *src, unsigned long len);
> extern void uprobe_handle_trampoline(struct pt_regs *regs);
> -extern void *arch_uprobe_trampoline(unsigned long *psize);
> +extern void *arch_uretprobe_trampoline(unsigned long *psize);
> extern unsigned long uprobe_get_trampoline_vaddr(void);
> #else /* !CONFIG_UPROBES */
> struct uprobes_state {
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index fa04b14a7d72..e0e3ebb4c0a1 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1695,7 +1695,7 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
> return ret;
> }
>
> -void * __weak arch_uprobe_trampoline(unsigned long *psize)
> +void * __weak arch_uretprobe_trampoline(unsigned long *psize)
> {
> static uprobe_opcode_t insn = UPROBE_SWBP_INSN;
>
> @@ -1727,7 +1727,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
> init_waitqueue_head(&area->wq);
> /* Reserve the 1st slot for get_trampoline_vaddr() */
> set_bit(0, area->bitmap);
> - insns = arch_uprobe_trampoline(&insns_size);
> + insns = arch_uretprobe_trampoline(&insns_size);
> arch_uprobe_copy_ixol(area->page, 0, insns, insns_size);
>
> if (!xol_add_vma(mm, area))
> --
> 2.47.0
>