[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <158824221003.2338.9700507405752328930.stgit@ebuild>
Date: Thu, 30 Apr 2020 12:23:34 +0200
From: Eelco Chaudron <echaudro@...hat.com>
To: bpf@...r.kernel.org
Cc: davem@...emloft.net, netdev@...r.kernel.org, ast@...nel.org,
daniel@...earbox.net, kafai@...com, songliubraving@...com,
yhs@...com, andriin@...com, toke@...hat.com
Subject: [PATCH bpf-next] libbpf: fix probe code to return EPERM if encountered
When the probe code was failing for any reason ENOTSUP was returned, even
if this was due to no having enough lock space. This patch fixes this by
returning EPERM to the user application, so it can respond and increase
the RLIMIT_MEMLOCK size.
Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
---
tools/lib/bpf/libbpf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 8f480e29a6b0..a62388a151d4 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3381,8 +3381,13 @@ 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)
+ if (ret < 0) {
pr_debug("Probe #%d failed with %d.\n", i, ret);
+ if (ret == -EPERM) {
+ pr_perm_msg(ret);
+ return ret;
+ }
+ }
}
return 0;
Powered by blists - more mailing lists