From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: <bpf@vger.kernel.org>, "Quentin Monnet" <qmo@kernel.org>,
"Tianyi Chen" <hi@tychen.cc>, "KP Singh" <kpsingh@kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Don't echo user-supplied map info fields back to userspace
Date: Fri, 16 Oct 2026 17:47:18 +0000 [thread overview]
Message-ID: <DM6G8ZUKITW8.A0II2HNX8268@gmail.com> (raw)
In-Reply-To: <20261016164153.656430-1-daniel@iogearbox.net>
On Fri, Oct 16, 2026 at 06:41 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
> @@ -5450,7 +5451,11 @@ static int bpf_map_get_info_by_fd(struct file *file,
> memset(&info, 0, sizeof(info));
> if (copy_from_user(&info, uinfo, info_len))
> return -EFAULT;
> -
> + hash = info.hash;
> + hash_size = info.hash_size;
> + memset(&info, 0, sizeof(info));
> + info.hash = hash;
> + info.hash_size = hash_size;
can we do
memset(&info, 0, offsetof(struct bpf_map_info, hash));
here instead ?
hash and hash_size are the last two fields and the padding after them
is checked by bpf_check_uarg_tail_zero() above.
Then no need for two extra variables and the 2nd full memset.
next prev parent reply other threads:[~2026-10-16 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 16:41 [PATCH bpf-next] bpf: Don't echo user-supplied map info fields back to userspace Daniel Borkmann
2026-10-16 17:47 ` Alexei Starovoitov [this message]
2026-10-16 18:28 ` Daniel Borkmann
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=DM6G8ZUKITW8.A0II2HNX8268@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hi@tychen.cc \
--cc=kpsingh@kernel.org \
--cc=qmo@kernel.org \
/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.