mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-21 16:59:07 +08:00
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
This commit is contained in:
committed by
Andrii Nakryiko
parent
bb92e7ab4d
commit
d7a2de020b
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user