From: ">" <jonathan.wiepert@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@kernel.org>,
Mykyta Yatsenko <yatsenko@meta.com>,
Yonghong Song <yonghong.song@linux.dev>,
Jordan Rome <linux@jordanrome.com>, Jiri Olsa <jolsa@kernel.org>,
Jonathan Wiepert <jonathan.wiepert@gmail.com>,
Kernel Team <kernel-team@fb.com>
Subject: [PATCH bpf-next] Use thread-safe function pointer in libbpf_print
Date: Thu, 24 Apr 2025 18:14:57 -0400 [thread overview]
Message-ID: <20250424221457.793068-1-jonathan.wiepert@gmail.com> (raw)
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
next reply other threads:[~2025-04-24 22:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 22:14 > [this message]
2025-04-25 0:31 ` [PATCH bpf-next] Use thread-safe function pointer in libbpf_print Mykyta Yatsenko
2025-04-25 16:28 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250424221457.793068-1-jonathan.wiepert@gmail.com \
--to=jonathan.wiepert@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux@jordanrome.com \
--cc=martin.lau@kernel.org \
--cc=yatsenko@meta.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox