diff options
| author | Jonathan Wiepert <[email protected]> | 2025-04-24 22:14:57 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2025-04-25 16:27:17 +0000 |
| commit | 91dbac4076537b464639953c055c460d2bdfc7ea (patch) | |
| tree | 0ea083355fd3dd12996f03632af2fd0276af0e21 /tools/lib/bpf/libbpf.c | |
| parent | libbpf: Remove sample_period init in perf_buffer (diff) | |
| download | kernel-91dbac4076537b464639953c055c460d2bdfc7ea.tar.gz kernel-91dbac4076537b464639953c055c460d2bdfc7ea.zip | |
Use thread-safe function pointer in libbpf_print
This patch fixes a thread safety bug where libbpf_print uses the
global variable storing the print function pointer rather than the local
variable that had the print function set via __atomic_load_n.
Fixes: f1cb927cdb62 ("libbpf: Ensure print callback usage is thread-safe")
Signed-off-by: Jonathan Wiepert <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Mykyta Yatsenko <[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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 080c699582c7..617cfb9a7ff5 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -286,7 +286,7 @@ void libbpf_print(enum libbpf_print_level level, const char *format, ...) old_errno = errno; va_start(args, format); - __libbpf_pr(level, format, args); + print_fn(level, format, args); va_end(args); errno = old_errno; |
