[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZJg6bcFjkvKR627PMDj6EBy7pSMHYq1T9pyfo5CpjFQA@mail.gmail.com>
Date: Tue, 12 Oct 2021 06:11:30 +0200
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH bpf-next 1/3] libbpf: use func name when pinning programs
with LIBBPF_STRICT_SEC_NAME
On Mon, Oct 11, 2021 at 5:56 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> We can't use section name anymore because it's not unique
> and pinning objects with multiple programs with the same
> progtype/secname will fail.
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
Also, patch sets with more than one related patch should come with the
cover letter, please send one on the next revision. Thanks!
> tools/lib/bpf/libbpf.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index ae0889bebe32..0373ca86a54c 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -285,7 +285,8 @@ struct bpf_program {
> size_t sub_insn_off;
>
> char *name;
> - /* sec_name with / replaced by _; makes recursive pinning
> + /* sec_name (or name when using LIBBPF_STRICT_SEC_NAME)
> + * with / replaced by _; makes recursive pinning
> * in bpf_object__pin_programs easier
> */
> char *pin_name;
> @@ -614,7 +615,11 @@ static char *__bpf_program__pin_name(struct bpf_program *prog)
> {
> char *name, *p;
>
> - name = p = strdup(prog->sec_name);
> + if (libbpf_mode & LIBBPF_STRICT_SEC_NAME)
> + name = p = strdup(prog->name);
> + else
> + name = p = strdup(prog->sec_name);
> +
> while ((p = strchr(p, '/')))
> *p = '_';
>
> --
> 2.33.0.882.g93a45727a2-goog
>
Powered by blists - more mailing lists