Skip to content

Commit 91dbac4

Browse files
jwiepertanakryiko
authored andcommitted
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: f1cb927 ("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]
1 parent 64821d2 commit 91dbac4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void libbpf_print(enum libbpf_print_level level, const char *format, ...)
286286
old_errno = errno;
287287

288288
va_start(args, format);
289-
__libbpf_pr(level, format, args);
289+
print_fn(level, format, args);
290290
va_end(args);
291291

292292
errno = old_errno;

0 commit comments

Comments
 (0)