mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-13 21:09:07 +08:00
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 <jonathan.wiepert@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
Link: https://lore.kernel.org/bpf/20250424221457.793068-1-jonathan.wiepert@gmail.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
a2dc135196
commit
88ae865423
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user