bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: ">" <jonathan.wiepert@gmail.com>, 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>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next] Use thread-safe function pointer in libbpf_print
Date: Fri, 25 Apr 2025 01:31:17 +0100	[thread overview]
Message-ID: <55eb79ff-4020-40ba-b690-756ab746ade7@gmail.com> (raw)
In-Reply-To: <20250424221457.793068-1-jonathan.wiepert@gmail.com>

On 4/24/25 23:14, > wrote:
> 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;
Acked-by: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>

  reply	other threads:[~2025-04-25  0:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 22:14 [PATCH bpf-next] Use thread-safe function pointer in libbpf_print >
2025-04-25  0:31 ` Mykyta Yatsenko [this message]
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=55eb79ff-4020-40ba-b690-756ab746ade7@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=jonathan.wiepert@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).