From: Anton Protopopov <aspsk@isovalent.com>
To: Yonghong Song <yonghong.song@linux.dev>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jiri Olsa <jolsa@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Stanislav Fomichev <sdf@google.com>,
bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/1] bpf: fix possible file descriptor leaks in verifier
Date: Fri, 29 Mar 2024 07:01:11 +0000 [thread overview]
Message-ID: <ZgZnNyeKSyEMxxYj@zh-lab-node-5> (raw)
In-Reply-To: <cf8d5e75-dc75-4f86-be60-013f7ed7c688@linux.dev>
On Thu, Mar 28, 2024 at 08:23:03PM -0700, Yonghong Song wrote:
>
> On 3/28/24 2:56 AM, Anton Protopopov wrote:
> > The resolve_pseudo_ldimm64() function might have leaked file
> > descriptors when BPF_MAP_TYPE_ARENA was used in a program (some
> > error paths missed a corresponding fdput).
> >
> > Fix leaks and also extract code which adds maps to env->used_maps
> > into a separate function. This simplifies code of resolve_pseudo_ldimm64
> > and makes it possible to reuse this code later. While at it, also add a
> > verifier verbose message when the maps usage limit is reached.
>
> Could you break this single patch into a series? For example,
> for 'to reuse this code later', refactoring the code (without
> funcitonality change) can be a separate patch, could you explain
> what do you mean reusing the code later? Do you have some plans
> to reuse the code later?
Yes, to pre-process file descriptors in attrs.fd_array (or a similar array).
See this thread https://lore.kernel.org/bpf/ZgWcsKZR23JIg51e@lavr/
> The fix for missing fdput() should be its own patch with
> Fixes tag below.
>
> You can have yet another patch to enhance verifier by adding
> verbose messages.
Thanks. I will just send two fixes for fdput and the verifier message.
I will send a patch which refactors code when it is needed.
> >
> > Fixes: 6082b6c328b5 ("bpf: Recognize addr_space_cast instruction in the verifier.")
> > Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
> > ---
> > kernel/bpf/verifier.c | 150 ++++++++++++++++++++++--------------------
> > 1 file changed, 79 insertions(+), 71 deletions(-)
> [...]
prev parent reply other threads:[~2024-03-29 6:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 9:56 [PATCH bpf-next 1/1] bpf: fix possible file descriptor leaks in verifier Anton Protopopov
2024-03-29 3:23 ` Yonghong Song
2024-03-29 7:01 ` Anton Protopopov [this message]
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=ZgZnNyeKSyEMxxYj@zh-lab-node-5 \
--to=aspsk@isovalent.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.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