From: Stanislav Fomichev <sdf@google.com>
To: Martin Kelly <martin.kelly@crowdstrike.com>
Cc: bpf@vger.kernel.org, Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Marco Vedovati <marco.vedovati@crowdstrike.com>
Subject: Re: [PATCH bpf-next] libbpf: set close-on-exec flag on gzopen
Date: Mon, 14 Aug 2023 10:03:15 -0700 [thread overview]
Message-ID: <ZNpeU4faW3wSgDVf@google.com> (raw)
In-Reply-To: <674989d5-abc1-60fb-64ea-da25d24f935e@crowdstrike.com>
On 08/10, Martin Kelly wrote:
> On 8/10/23 14:43, Martin Kelly wrote:
> > From: Marco Vedovati <marco.vedovati@crowdstrike.com>
> >
> > Enable the close-on-exec flag when using gzopen
> >
> > This is especially important for multithreaded programs making use of
> > libbpf, where a fork + exec could race with libbpf library calls,
> > potentially resulting in a file descriptor leaked to the new process.
> >
> > Signed-off-by: Marco Vedovati <marco.vedovati@crowdstrike.com>
> > ---
> > tools/lib/bpf/libbpf.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index 17883f5a44b9..b14a4376a86e 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -1978,9 +1978,9 @@ static int bpf_object__read_kconfig_file(struct bpf_object *obj, void *data)
> > return -ENAMETOOLONG;
> > /* gzopen also accepts uncompressed files. */
> > - file = gzopen(buf, "r");
> > + file = gzopen(buf, "re");
> > if (!file)
> > - file = gzopen("/proc/config.gz", "r");
> > + file = gzopen("/proc/config.gz", "re");
> > if (!file) {
> > pr_warn("failed to open system Kconfig\n");
>
> Sorry for double-sending the patch; the first was missing the bpf-next
> prefix and I wasn't sure if that would be an issue. Feel free to ignore this
> patch, as the other already got a reply.
Oops, I missed your resend:
https://lore.kernel.org/bpf/ZNVf6kHamI9awatB@google.com/
Next time pls at least reply to the first 'wrong' one :-)
next prev parent reply other threads:[~2023-08-14 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 21:43 [PATCH bpf-next] libbpf: set close-on-exec flag on gzopen Martin Kelly
2023-08-10 22:18 ` Martin Kelly
2023-08-14 17:03 ` Stanislav Fomichev [this message]
2023-08-14 18:48 ` [External] " Martin Kelly
2023-08-14 15:40 ` patchwork-bot+netdevbpf
2023-08-14 15:40 ` Daniel Borkmann
2023-08-14 19:22 ` Martin Kelly
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=ZNpeU4faW3wSgDVf@google.com \
--to=sdf@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=marco.vedovati@crowdstrike.com \
--cc=martin.kelly@crowdstrike.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.