Re: [PATCHv4 bpf-next 4/6] bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 22, 2022 at 2:04 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> Martynas reported bpf_get_func_ip returning +4 address when
> CONFIG_X86_KERNEL_IBT option is enabled.
>
> When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction
> at the function entry, which screws return value of bpf_get_func_ip()
> helper that should return the function address.
>
> There's short term workaround for kprobe_multi bpf program made by
> Alexei [1], but we need this fixup also for bpf_get_attach_cookie,
> that returns cookie based on the entry_ip value.
>
> Moving the fixup in the fprobe handler, so both bpf_get_func_ip
> and bpf_get_attach_cookie get expected function address when
> CONFIG_X86_KERNEL_IBT option is enabled.
>
> Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip
> so it's clearer this is an ftrace __fentry__ ip.
>
> [1] commit 7f0059b58f02 ("selftests/bpf: Fix kprobe_multi test.")
>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Reported-by: Martynas Pumputis <m@xxxxxxxxx>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---

lgtm

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

>  kernel/trace/bpf_trace.c                      | 20 +++++++++++++++++--
>  .../selftests/bpf/progs/kprobe_multi.c        |  4 +---
>  2 files changed, 19 insertions(+), 5 deletions(-)
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux