On Wed, May 18, 2022 at 6:54 AM Xu Kuohai <[email protected]> wrote:
>
> Add bpf trampoline support for arm64. Most of the logic is the same as
> x86.
>
> Tested on raspberry pi 4b and qemu with KASLR disabled (avoid long jump),
> result:
> #9 /1 bpf_cookie/kprobe:OK
> #9 /2 bpf_cookie/multi_kprobe_link_api:FAIL
> #9 /3 bpf_cookie/multi_kprobe_attach_api:FAIL
> #9 /4 bpf_cookie/uprobe:OK
> #9 /5 bpf_cookie/tracepoint:OK
> #9 /6 bpf_cookie/perf_event:OK
> #9 /7 bpf_cookie/trampoline:OK
> #9 /8 bpf_cookie/lsm:OK
> #9 bpf_cookie:FAIL
> #18 /1 bpf_tcp_ca/dctcp:OK
> #18 /2 bpf_tcp_ca/cubic:OK
> #18 /3 bpf_tcp_ca/invalid_license:OK
> #18 /4 bpf_tcp_ca/dctcp_fallback:OK
> #18 /5 bpf_tcp_ca/rel_setsockopt:OK
> #18 bpf_tcp_ca:OK
> #51 /1 dummy_st_ops/dummy_st_ops_attach:OK
> #51 /2 dummy_st_ops/dummy_init_ret_value:OK
> #51 /3 dummy_st_ops/dummy_init_ptr_arg:OK
> #51 /4 dummy_st_ops/dummy_multiple_args:OK
> #51 dummy_st_ops:OK
> #55 fentry_fexit:OK
> #56 fentry_test:OK
> #57 /1 fexit_bpf2bpf/target_no_callees:OK
> #57 /2 fexit_bpf2bpf/target_yes_callees:OK
> #57 /3 fexit_bpf2bpf/func_replace:OK
> #57 /4 fexit_bpf2bpf/func_replace_verify:OK
> #57 /5 fexit_bpf2bpf/func_sockmap_update:OK
> #57 /6 fexit_bpf2bpf/func_replace_return_code:OK
> #57 /7 fexit_bpf2bpf/func_map_prog_compatibility:OK
> #57 /8 fexit_bpf2bpf/func_replace_multi:OK
> #57 /9 fexit_bpf2bpf/fmod_ret_freplace:OK
> #57 fexit_bpf2bpf:OK
> #58 fexit_sleep:OK
> #59 fexit_stress:OK
> #60 fexit_test:OK
> #67 get_func_args_test:OK
> #68 get_func_ip_test:OK
> #104 modify_return:OK
> #237 xdp_bpf2bpf:OK
>
> bpf_cookie/multi_kprobe_link_api and bpf_cookie/multi_kprobe_attach_api
> failed due to lack of multi_kprobe on arm64.
>
> Signed-off-by: Xu Kuohai <[email protected]>
> Acked-by: Song Liu <[email protected]>
Catalin, Will, Mark,
could you please ack this patch that you don't mind us
taking this set through bpf-next ?
On Fri, May 20, 2022 at 02:18:20PM -0700, Alexei Starovoitov wrote:
> On Wed, May 18, 2022 at 6:54 AM Xu Kuohai <[email protected]> wrote:
> >
> > Add bpf trampoline support for arm64. Most of the logic is the same as
> > x86.
> >
> > Tested on raspberry pi 4b and qemu with KASLR disabled (avoid long jump),
> > result:
> > #9 /1 bpf_cookie/kprobe:OK
> > #9 /2 bpf_cookie/multi_kprobe_link_api:FAIL
> > #9 /3 bpf_cookie/multi_kprobe_attach_api:FAIL
> > #9 /4 bpf_cookie/uprobe:OK
> > #9 /5 bpf_cookie/tracepoint:OK
> > #9 /6 bpf_cookie/perf_event:OK
> > #9 /7 bpf_cookie/trampoline:OK
> > #9 /8 bpf_cookie/lsm:OK
> > #9 bpf_cookie:FAIL
> > #18 /1 bpf_tcp_ca/dctcp:OK
> > #18 /2 bpf_tcp_ca/cubic:OK
> > #18 /3 bpf_tcp_ca/invalid_license:OK
> > #18 /4 bpf_tcp_ca/dctcp_fallback:OK
> > #18 /5 bpf_tcp_ca/rel_setsockopt:OK
> > #18 bpf_tcp_ca:OK
> > #51 /1 dummy_st_ops/dummy_st_ops_attach:OK
> > #51 /2 dummy_st_ops/dummy_init_ret_value:OK
> > #51 /3 dummy_st_ops/dummy_init_ptr_arg:OK
> > #51 /4 dummy_st_ops/dummy_multiple_args:OK
> > #51 dummy_st_ops:OK
> > #55 fentry_fexit:OK
> > #56 fentry_test:OK
> > #57 /1 fexit_bpf2bpf/target_no_callees:OK
> > #57 /2 fexit_bpf2bpf/target_yes_callees:OK
> > #57 /3 fexit_bpf2bpf/func_replace:OK
> > #57 /4 fexit_bpf2bpf/func_replace_verify:OK
> > #57 /5 fexit_bpf2bpf/func_sockmap_update:OK
> > #57 /6 fexit_bpf2bpf/func_replace_return_code:OK
> > #57 /7 fexit_bpf2bpf/func_map_prog_compatibility:OK
> > #57 /8 fexit_bpf2bpf/func_replace_multi:OK
> > #57 /9 fexit_bpf2bpf/fmod_ret_freplace:OK
> > #57 fexit_bpf2bpf:OK
> > #58 fexit_sleep:OK
> > #59 fexit_stress:OK
> > #60 fexit_test:OK
> > #67 get_func_args_test:OK
> > #68 get_func_ip_test:OK
> > #104 modify_return:OK
> > #237 xdp_bpf2bpf:OK
> >
> > bpf_cookie/multi_kprobe_link_api and bpf_cookie/multi_kprobe_attach_api
> > failed due to lack of multi_kprobe on arm64.
> >
> > Signed-off-by: Xu Kuohai <[email protected]>
> > Acked-by: Song Liu <[email protected]>
>
> Catalin, Will, Mark,
>
> could you please ack this patch that you don't mind us
> taking this set through bpf-next ?
This is on my queue of things to review alongside some other ftrace and kprobes
patches; I'll try to get that out of the way this week.
From a quick glance I'm not too keen on the change to the ftrace trampoline, as
to get rid of some existing unsoundness I'd really wanted to move that entirely
away from using regs (and had a sketch for how to handle different op
handlers). I'd discussed that with Steven and Masami in another thread:
https://lore.kernel.org/linux-arm-kernel/YnJUTuOIX9YoJq23@FVFF77S0Q05N/
I'll see if it's possible to make this all work together. It's not entirely
clear to me how the FTRACE_DIRECT its are supposed to play with dynamically
allocated trampolines, and we might need to take a step back and reconsider.
Thanks,
Mark.