]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix uprobe symbol file offset calculation logic
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 6 Jun 2022 22:01:43 +0000 (15:01 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 9 Jun 2022 12:09:41 +0000 (14:09 +0200)
commit90922c8d029b64bca3701f544365ac5f47632a39
tree99190a8f63b41fdce6cb0224dd1b36b5dcc9a5bc
parent7572550a100f6f5d5db1bccbf4650edfc54f2773
libbpf: Fix uprobe symbol file offset calculation logic

Fix libbpf's bpf_program__attach_uprobe() logic of determining
function's *file offset* (which is what kernel is actually expecting)
when attaching uprobe/uretprobe by function name. Previously calculation
was determining virtual address offset relative to base load address,
which (offset) is not always the same as file offset (though very
frequently it is which is why this went unnoticed for a while).

Fixes: 864ae2647cc5 ("libbpf: Support function name-based attach uprobes")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Riham Selim <rihams@fb.com>
Cc: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/20220606220143.3796908-1-andrii@kernel.org
tools/lib/bpf/libbpf.c