libbpf: don't fail when feature probing fails
authorStanislav Fomichev <sdf@google.com>
Wed, 15 May 2019 03:38:49 +0000 (20:38 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 15 May 2019 23:32:19 +0000 (01:32 +0200)
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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c

index 7e3b79d7c25f68487285d6f3b218da6c4f45a481..3562b6ef5fdcbaea58e86926efd229443e844b88 100644 (file)
@@ -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;