Re: [RFC PATCH v7 6/8] tools/libbpf: Add support for BPF_PROG_TYPE_QDISC

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

 



On Mon, Jan 22, 2024 at 4:18 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Wed, Jan 17, 2024 at 1:57 PM Amery Hung <ameryhung@xxxxxxxxx> wrote:
> >
> > While eBPF qdisc uses NETLINK for attachment, expected_attach_type is
> > required at load time to verify context access from different programs.
> > This patch adds the section definition for this.
> >
> > Signed-off-by: Amery Hung <amery.hung@xxxxxxxxxxxxx>
> > ---
> >  tools/lib/bpf/libbpf.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index e067be95da3c..0541f85b4ce6 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -8991,6 +8991,10 @@ static const struct bpf_sec_def section_defs[] = {
> >         SEC_DEF("struct_ops.s+",        STRUCT_OPS, 0, SEC_SLEEPABLE),
> >         SEC_DEF("sk_lookup",            SK_LOOKUP, BPF_SK_LOOKUP, SEC_ATTACHABLE),
> >         SEC_DEF("netfilter",            NETFILTER, BPF_NETFILTER, SEC_NONE),
> > +       SEC_DEF("qdisc/enqueue",        QDISC, BPF_QDISC_ENQUEUE, SEC_ATTACHABLE_OPT),
> > +       SEC_DEF("qdisc/dequeue",        QDISC, BPF_QDISC_DEQUEUE, SEC_ATTACHABLE_OPT),
> > +       SEC_DEF("qdisc/reset",          QDISC, BPF_QDISC_RESET, SEC_ATTACHABLE_OPT),
> > +       SEC_DEF("qdisc/init",           QDISC, BPF_QDISC_INIT, SEC_ATTACHABLE_OPT),
>
> seems like SEC_ATTACHABLE (or just 0) is what you want.
> expected_attach_type shouldn't be optional for any new program type
>

Got it. Will change the flags to SEC_NONE.

> >  };
> >
> >  int libbpf_register_prog_handler(const char *sec,
> > --
> > 2.20.1
> >
> >





[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