Re: [PATCH v2 bpf 5/5] libbpf: warn on unexpected __arg_ctx type when rewriting BTF

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

 



On Thu, Jan 18, 2024 at 11:50 AM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> On Wed, 2024-01-17 at 14:33 -0800, Andrii Nakryiko wrote:
> [...]
>
> > +     /* special cases */
> > +     switch (prog->type) {
> > +     case BPF_PROG_TYPE_KPROBE:
> > +     case BPF_PROG_TYPE_PERF_EVENT:
> > +             /* `struct pt_regs *` is expected, but we need to fix up */
> > +             if (btf_is_struct(t) && strcmp(tname, "pt_regs") == 0)
> > +                     return true;
> > +             break;
>
> Just to double-check my understanding, in patch #3 you say:
>
> > for perf_event kernel allows `struct {pt_regs,user_pt_regs,user_regs_struct} *`.
>
> Here `true` is returned only for `pt_regs`,
> meaning that arch specific types "user_pt_regs" and "user_regs_struct"
> would not be converted to "bpf_perf_event_data" but "pt_regs" would, right?

yes, it's a slight deviation from what I ended up doing in the kernel,
because I initially didn't know how to deal with arch-specific
definitions of bpf_user_pt_regs_t. But at the last moment I figured
out that __builtin_types_compatible_p and forward declaring structs
works, so I'll do a small follow up to libbpf to match kernel logic
completely

>
> [...]
>
>





[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