From: Martynas Pumputis <m@lambda.lt>
To: David Ahern <dsahern@gmail.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Networking <netdev@vger.kernel.org>,
Hangbin Liu <haliu@redhat.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH iproute2] libbpf: fix attach of prog with multiple sections
Date: Wed, 21 Jul 2021 17:27:29 +0200 [thread overview]
Message-ID: <a68f1e05-e9c7-595e-23e9-6f02a3a209de@lambda.lt> (raw)
In-Reply-To: <4f1b5aaa-80e0-5dcc-277e-c098811cc359@gmail.com>
On 7/21/21 4:59 PM, David Ahern wrote:
> On 7/21/21 8:47 AM, Martynas Pumputis wrote:
>>>> diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c
>>>> index d05737a4..f76b90d2 100644
>>>> --- a/lib/bpf_libbpf.c
>>>> +++ b/lib/bpf_libbpf.c
>>>> @@ -267,10 +267,12 @@ static int load_bpf_object(struct bpf_cfg_in *cfg)
>>>> }
>>>>
>>>> bpf_object__for_each_program(p, obj) {
>>>> + bool prog_to_attach = !prog && cfg->section &&
>>>> + !strcmp(get_bpf_program__section_name(p),
>>>> cfg->section);
>>>
>>> This is still problematic, because one section can have multiple BPF
>>> programs. I.e., it's possible two define two or more XDP BPF programs
>>> all with SEC("xdp") and libbpf works just fine with that. I suggest
>>> moving users to specify the program name (i.e., C function name
>>> representing the BPF program). All the xdp_mycustom_suffix namings are
>>> a hack and will be rejected by libbpf 1.0, so it would be great to get
>>> a head start on fixing this early on.
>>
>> Thanks for bringing this up. Currently, there is no way to specify a
>> function name with "tc exec bpf" (only a section name via the "sec"
>> arg). So probably, we should just add another arg to specify the
>> function name.
>>
>> It would be interesting to hear thoughts from iproute2 maintainers
>> before fixing this.
>
> maintaining backwards compatibility is a core principle for iproute2. If
> we know of a libbpf change is going to cause a breakage then it is best
> to fix it before any iproute2 release is affected.
>
Just to avoid any confusion (if there is any), the required change we
are discussing doesn't have anything to do with my fix.
To set the context, the motivation for unifying section names is
documented and discussed in "Stricter and more uniform BPF program
section name (SEC()) handling" of [1].
Andrii: is bpftool able to load programs with multiple sections which
are named the same today?
[1]:
https://docs.google.com/document/d/1UyjTZuPFWiPFyKk1tV5an11_iaRuec6U-ZESZ54nNTY/edit#
next prev parent reply other threads:[~2021-07-21 15:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 12:43 [PATCH iproute2] libbpf: fix attach of prog with multiple sections Martynas Pumputis
2021-07-06 2:44 ` Hangbin Liu
2021-07-20 20:27 ` Andrii Nakryiko
2021-07-21 14:47 ` Martynas Pumputis
2021-07-21 14:59 ` David Ahern
2021-07-21 15:27 ` Martynas Pumputis [this message]
2021-07-23 4:01 ` Andrii Nakryiko
2021-07-23 4:41 ` Hangbin Liu
2021-07-23 4:51 ` Andrii Nakryiko
2021-07-23 7:55 ` Hangbin Liu
2021-07-23 16:09 ` Andrii Nakryiko
2021-07-24 8:12 ` Hangbin Liu
2021-07-24 0:12 ` David Ahern
2021-07-24 0:25 ` Andrii Nakryiko
2021-07-26 13:58 ` David Ahern
2021-07-26 15:13 ` Andrii Nakryiko
2021-07-27 2:51 ` David Ahern
2021-07-27 19:05 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a68f1e05-e9c7-595e-23e9-6f02a3a209de@lambda.lt \
--to=m@lambda.lt \
--cc=andrii.nakryiko@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=haliu@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.