mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] libbpf: fix multi-uprobe attach not working with dynamic symbols
@ 2025-03-27 10:07 Mateusz Bieganski
  2025-03-28 18:14 ` Andrii Nakryiko
  0 siblings, 1 reply; 3+ messages in thread
From: Mateusz Bieganski @ 2025-03-27 10:07 UTC (permalink / raw)
  Cc: bieganski.gm, Andrii Nakryiko, Eduard Zingerman,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, open list:BPF [LIBRARY] (libbpf),
	open list

ENOENT is incorrectly propagated to caller, if requested symbol is
present in dynamic linker symbol table and not present in symbol table.

Signed-off-by: Mateusz Bieganski <bieganski.gm@gmail.com>
---
 tools/lib/bpf/elf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/elf.c b/tools/lib/bpf/elf.c
index 823f83ad819c..41839ef5bc97 100644
--- a/tools/lib/bpf/elf.c
+++ b/tools/lib/bpf/elf.c
@@ -439,8 +439,10 @@ int elf_resolve_syms_offsets(const char *binary_path, int cnt,
 		struct elf_sym *sym;
 
 		err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], st_type);
-		if (err == -ENOENT)
+		if (err == -ENOENT) {
+			err = 0;
 			continue;
+		}
 		if (err)
 			goto out;
 
-- 
2.39.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: fix multi-uprobe attach not working with dynamic symbols
  2025-03-27 10:07 [PATCH] libbpf: fix multi-uprobe attach not working with dynamic symbols Mateusz Bieganski
@ 2025-03-28 18:14 ` Andrii Nakryiko
  2025-04-03  9:45   ` Jiri Olsa
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2025-03-28 18:14 UTC (permalink / raw)
  To: Mateusz Bieganski
  Cc: Andrii Nakryiko, Eduard Zingerman, Alexei Starovoitov,
	Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	open list:BPF [LIBRARY] (libbpf),
	open list

On Thu, Mar 27, 2025 at 3:08 AM Mateusz Bieganski
<bieganski.gm@gmail.com> wrote:
>
> ENOENT is incorrectly propagated to caller, if requested symbol is
> present in dynamic linker symbol table and not present in symbol table.
>
> Signed-off-by: Mateusz Bieganski <bieganski.gm@gmail.com>
> ---
>  tools/lib/bpf/elf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/elf.c b/tools/lib/bpf/elf.c
> index 823f83ad819c..41839ef5bc97 100644
> --- a/tools/lib/bpf/elf.c
> +++ b/tools/lib/bpf/elf.c
> @@ -439,8 +439,10 @@ int elf_resolve_syms_offsets(const char *binary_path, int cnt,
>                 struct elf_sym *sym;
>
>                 err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], st_type);
> -               if (err == -ENOENT)
> +               if (err == -ENOENT) {
> +                       err = 0;
>                         continue;
> +               }

Don't we have the same problem in elf_resolve_pattern_offsets() as
well? Can you please fix both issues in one go?

It seems it's only elf_find_func_offset() that do want to preserve
that -ENOENT, all others are just error-prone implementations.

pw-bot: cr

>                 if (err)
>                         goto out;
>
> --
> 2.39.5
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: fix multi-uprobe attach not working with dynamic symbols
  2025-03-28 18:14 ` Andrii Nakryiko
@ 2025-04-03  9:45   ` Jiri Olsa
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2025-04-03  9:45 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Mateusz Bieganski, Andrii Nakryiko, Eduard Zingerman,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, open list:BPF [LIBRARY] (libbpf),
	open list

On Fri, Mar 28, 2025 at 11:14:54AM -0700, Andrii Nakryiko wrote:
> On Thu, Mar 27, 2025 at 3:08 AM Mateusz Bieganski
> <bieganski.gm@gmail.com> wrote:
> >
> > ENOENT is incorrectly propagated to caller, if requested symbol is
> > present in dynamic linker symbol table and not present in symbol table.
> >
> > Signed-off-by: Mateusz Bieganski <bieganski.gm@gmail.com>
> > ---
> >  tools/lib/bpf/elf.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/elf.c b/tools/lib/bpf/elf.c
> > index 823f83ad819c..41839ef5bc97 100644
> > --- a/tools/lib/bpf/elf.c
> > +++ b/tools/lib/bpf/elf.c
> > @@ -439,8 +439,10 @@ int elf_resolve_syms_offsets(const char *binary_path, int cnt,
> >                 struct elf_sym *sym;
> >
> >                 err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], st_type);
> > -               if (err == -ENOENT)
> > +               if (err == -ENOENT) {
> > +                       err = 0;
> >                         continue;
> > +               }
> 
> Don't we have the same problem in elf_resolve_pattern_offsets() as
> well? Can you please fix both issues in one go?
> 
> It seems it's only elf_find_func_offset() that do want to preserve
> that -ENOENT, all others are just error-prone implementations.

+1, thanks for the fix

jirka

> 
> pw-bot: cr
> 
> >                 if (err)
> >                         goto out;
> >
> > --
> > 2.39.5
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-03  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-27 10:07 [PATCH] libbpf: fix multi-uprobe attach not working with dynamic symbols Mateusz Bieganski
2025-03-28 18:14 ` Andrii Nakryiko
2025-04-03  9:45   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®