All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] libbpf: don't fail when feature probing fails
@ 2019-05-15  3:38 Stanislav Fomichev
  2019-05-15 23:42 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Fomichev @ 2019-05-15  3:38 UTC (permalink / raw)
  To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev

Otherwise libbpf is unusable from unprivileged process with
kernel.kernel.unprivileged_bpf_disabled=1.
All I get is EPERM from the probes, even if I just want to
open an ELF object and look at what progs/maps it has.

Instead of dying on probes, let's just pr_debug the error and
try to continue.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7e3b79d7c25f..3562b6ef5fdc 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1696,7 +1696,7 @@ bpf_object__probe_caps(struct bpf_object *obj)
 	for (i = 0; i < ARRAY_SIZE(probe_fn); i++) {
 		ret = probe_fn[i](obj);
 		if (ret < 0)
-			return ret;
+			pr_debug("Probe #%d failed with %d.\n", i, ret);
 	}
 
 	return 0;
-- 
2.21.0.1020.gf2820cf01a-goog


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

* Re: [PATCH bpf] libbpf: don't fail when feature probing fails
  2019-05-15  3:38 [PATCH bpf] libbpf: don't fail when feature probing fails Stanislav Fomichev
@ 2019-05-15 23:42 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2019-05-15 23:42 UTC (permalink / raw)
  To: Stanislav Fomichev, netdev, bpf; +Cc: davem, ast

On 05/15/2019 05:38 AM, Stanislav Fomichev wrote:
> Otherwise libbpf is unusable from unprivileged process with
> kernel.kernel.unprivileged_bpf_disabled=1.
> All I get is EPERM from the probes, even if I just want to
> open an ELF object and look at what progs/maps it has.
> 
> Instead of dying on probes, let's just pr_debug the error and
> try to continue.
> 
> Signed-off-by: Stanislav Fomichev <sdf@google.com>

Good catch, applied, thanks!

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

end of thread, other threads:[~2019-05-16  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  3:38 [PATCH bpf] libbpf: don't fail when feature probing fails Stanislav Fomichev
2019-05-15 23:42 ` Daniel Borkmann

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.