]> 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)
commit6ed8b778bd5f11552b744a395dddcc6d169f9281
tree99190a8f63b41fdce6cb0224dd1b36b5dcc9a5bc
parent3f32528b3e037ced4e61d5fffa402d030cc0ae35
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: 7a79422cddd4 ("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