aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorAlan Maguire <[email protected]>2022-04-06 11:43:49 +0000
committerAndrii Nakryiko <[email protected]>2022-04-07 18:42:50 +0000
commita1c9d61b19cbc0b9618c0a0400c304ecb63221d5 (patch)
tree7fec36eb34417328a9f5d9ea564c3ba07f504ecf /tools/lib/bpf/libbpf.c
parentselftests/bpf: Test for writes to map key from BPF helpers (diff)
downloadkernel-a1c9d61b19cbc0b9618c0a0400c304ecb63221d5.tar.gz
kernel-a1c9d61b19cbc0b9618c0a0400c304ecb63221d5.zip
libbpf: Improve library identification for uprobe binary path resolution
In the process of doing path resolution for uprobe attach, libraries are identified by matching a ".so" substring in the binary_path. This matches a lot of patterns that do not conform to library.so[.version] format, so instead match a ".so" _suffix_, and if that fails match a ".so." substring for the versioned library case. Suggested-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alan Maguire <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-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 1111e9d16e01..c92226a150d0 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -10766,7 +10766,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
const char *search_paths[3] = {};
int i;
- if (strstr(file, ".so")) {
+ if (str_has_sfx(file, ".so") || strstr(file, ".so.")) {
search_paths[0] = getenv("LD_LIBRARY_PATH");
search_paths[1] = "/usr/lib64:/usr/lib";
search_paths[2] = arch_specific_lib_paths();