From: Boris Burkov <boris@bur.io>
To: sdf@google.com
Cc: Rong Tao <rtoax@foxmail.com>,
andrii@kernel.org, rongtao@cestc.cn,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
"open list:BPF [LIBRARY] (libbpf)" <bpf@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] libbpf: poison strlcpy()
Date: Wed, 8 Mar 2023 16:30:55 -0800 [thread overview]
Message-ID: <20230309003055.GA6586@zen> (raw)
In-Reply-To: <Y7cbM1D2YvB9tdqg@google.com>
On Thu, Jan 05, 2023 at 10:47:15AM -0800, sdf@google.com wrote:
> On 01/05, Rong Tao wrote:
> > From: Rong Tao <rongtao@cestc.cn>
>
> > Since commit 9fc205b413b3("libbpf: Add sane strncpy alternative and use
> > it internally") introduce libbpf_strlcpy(), thus add strlcpy() to a poison
> > list to prevent accidental use of it.
>
> > Signed-off-by: Rong Tao <rongtao@cestc.cn>
>
> Acked-by: Stanislav Fomichev <sdf@google.com>
>
> > ---
> > tools/lib/bpf/libbpf_internal.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> > diff --git a/tools/lib/bpf/libbpf_internal.h
> > b/tools/lib/bpf/libbpf_internal.h
> > index 377642ff51fc..2d26ded383ca 100644
> > --- a/tools/lib/bpf/libbpf_internal.h
> > +++ b/tools/lib/bpf/libbpf_internal.h
> > @@ -20,8 +20,8 @@
> > /* make sure libbpf doesn't use kernel-only integer typedefs */
> > #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
>
> > -/* prevent accidental re-addition of reallocarray() */
> > -#pragma GCC poison reallocarray
> > +/* prevent accidental re-addition of reallocarray()/strlcpy() */
> > +#pragma GCC poison reallocarray strlcpy
On my musl system, I believe this broke compilation, as string.h defines
strlcpy, and is included after this poisoning when compiling strset.c
FWIW, I could work around it by adding
#include <string.h>
above
#include <libbpf_internal.h>
in strset.c, since the poison doesn't apply to symbols that existed
before it ran, but this feels like a kludge, and not in the spirit of
the original poisoning patch..
I'm curious what the proper workaround should be for a libc that defines
strlcpy.
Thanks,
Boris
>
> > #include "libbpf.h"
> > #include "btf.h"
> > --
> > 2.39.0
>
next prev parent reply other threads:[~2023-03-09 0:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 14:36 [PATCH bpf-next] libbpf: poison strlcpy() Rong Tao
2023-01-05 18:47 ` sdf
2023-03-09 0:30 ` Boris Burkov [this message]
2023-03-09 0:32 ` Stanislav Fomichev
2023-01-06 16:10 ` patchwork-bot+netdevbpf
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=20230309003055.GA6586@zen \
--to=boris@bur.io \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/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