BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] Use thread-safe function pointer in libbpf_print
@ 2025-04-24 22:14 >
  2025-04-25  0:31 ` Mykyta Yatsenko
  2025-04-25 16:28 ` Andrii Nakryiko
  0 siblings, 2 replies; 3+ messages in thread
From: > @ 2025-04-24 22:14 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Mykyta Yatsenko, Yonghong Song, Jordan Rome,
	Jiri Olsa, Jonathan Wiepert, Kernel Team

From: Jonathan Wiepert <jonathan.wiepert@gmail.com>

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.

Signed-off-by: Jonathan Wiepert <jonathan.wiepert@gmail.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 56250b5ac5b0..ea97a84460cd 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -284,7 +284,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;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-25 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 22:14 [PATCH bpf-next] Use thread-safe function pointer in libbpf_print >
2025-04-25  0:31 ` Mykyta Yatsenko
2025-04-25 16:28 ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox