[PATCH v2 2/2] x86/cfi,bpf: Fix BPF JIT call

Alexei Starovoitov alexei.starovoitov at gmail.com
Fri Dec 8 11:32:07 PST 2023


On Fri, Dec 8, 2023 at 5:41 AM Peter Zijlstra <peterz at infradead.org> wrote:
>
> On Fri, Dec 08, 2023 at 11:29:40AM +0100, Peter Zijlstra wrote:
> > The only problem I now have is the one XXX, I'm not entirely sure what
> > signature to use there.
>
> > @@ -119,6 +119,7 @@ int bpf_struct_ops_test_run(struct bpf_p
> >       op_idx = prog->expected_attach_type;
> >       err = bpf_struct_ops_prepare_trampoline(tlinks, link,
> >                                               &st_ops->func_models[op_idx],
> > +                                             /* XXX */ NULL,
> >                                               image, image + PAGE_SIZE);
> >       if (err < 0)
> >               goto out;
>
> Duh, that should ofcourse be something of dummy_ops_test_ret_fn type.
> Let me go fix that.

Right. That should work.
A bit wasteful to generate real code just to read hash from it
via cfi_get_func_hash(), but it's a neat idea.
I guess it's hard to get kcfi from __ADDRESSABLE in plain C
and sprinkling asm("cfi_xxx: .long   __kcfi_typeid..."); is worse?
Even if it's a macro ?
That macro would be used to define cfi_bpf_hash and all other stubs?



More information about the linux-riscv mailing list