summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2021-07-21 23:58:09 +0200
committerAndrii Nakryiko <andrii@kernel.org>2021-07-22 20:09:16 -0700
commite3f9bc35ea7e9871667d7f769cf0079211828e89 (patch)
treead75453ffd707488d850db04610ec0a7fc79844f /tools/lib
parent1f71a468a75ff4f13c55966c74284aa4a6bcc334 (diff)
libbpf: Allow decimal offset for kprobes
Allow to specify decimal offset in SEC macro, like: SEC("kprobe/bpf_fentry_test7+5") Add selftest for that. Suggested-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Tested-by: Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/bpf/20210721215810.889975-3-jolsa@kernel.org
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/libbpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index d46c2dd37be2..52f4f1d4f495 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -10424,7 +10424,7 @@ static struct bpf_link *attach_kprobe(const struct bpf_sec_def *sec,
func_name = prog->sec_name + sec->len;
opts.retprobe = strcmp(sec->sec, "kretprobe/") == 0;
- n = sscanf(func_name, "%m[a-zA-Z0-9_.]+%lx", &func, &offset);
+ n = sscanf(func_name, "%m[a-zA-Z0-9_.]+%li", &func, &offset);
if (n < 1) {
err = -EINVAL;
pr_warn("kprobe name is invalid: %s\n", func_name);