Thread (33 messages) 33 messages, 7 authors, 2024-02-09

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

From: Amery Hung <hidden>
Date: 2024-01-23 19:40:45
Also in: bpf

On Mon, Jan 22, 2024 at 4:18 PM Andrii Nakryiko
[off-list ref] wrote:
On Wed, Jan 17, 2024 at 1:57 PM Amery Hung [off-list ref] wrote:
quoted
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 <redacted>
---
 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.
quoted
 };

 int libbpf_register_prog_handler(const char *sec,
--
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help