From: Peilin Ye <yepeilin.cs@gmail•com>
To: Song Liu <song@kernel•org>
Cc: "Björn Töpel" <bjorn.topel@intel•com>,
"Magnus Karlsson" <magnus.karlsson@intel•com>,
"Jonathan Lemon" <jonathan.lemon@gmail•com>,
"Dan Carpenter" <dan.carpenter@oracle•com>,
"Arnd Bergmann" <arnd@arndb•de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation•org>,
"David S. Miller" <davem@davemloft•net>,
"Jakub Kicinski" <kuba@kernel•org>,
"Alexei Starovoitov" <ast@kernel•org>,
"Daniel Borkmann" <daniel@iogearbox•net>,
"Jesper Dangaard Brouer" <hawk@kernel•org>,
"John Fastabend" <john.fastabend@gmail•com>,
"Martin KaFai Lau" <kafai@fb•com>,
"Song Liu" <songliubraving@fb•com>, "Yonghong Song" <yhs@fb•com>,
"Andrii Nakryiko" <andriin@fb•com>,
"KP Singh" <kpsingh@chromium•org>,
linux-kernel-mentees@lists•linuxfoundation.org,
Networking <netdev@vger•kernel.org>, bpf <bpf@vger•kernel.org>,
"open list" <linux-kernel@vger•kernel.org>
Subject: Re: [Linux-kernel-mentees] [PATCH net] xdp: Prevent kernel-infoleak in xsk_getsockopt()
Date: Tue, 28 Jul 2020 01:25:12 -0400 [thread overview]
Message-ID: <20200728052512.GA404005@PWN> (raw)
In-Reply-To: <CAPhsuW7L6KWAM55=oLgQ2MtoJOB9i4mwZHOVF+KJj7W5ht_+YQ@mail.gmail.com>
On Mon, Jul 27, 2020 at 10:07:20PM -0700, Song Liu wrote:
> On Mon, Jul 27, 2020 at 7:30 PM Peilin Ye <yepeilin.cs@gmail•com> wrote:
> >
> > xsk_getsockopt() is copying uninitialized stack memory to userspace when
> > `extra_stats` is `false`. Fix it by initializing `stats` with memset().
> >
> > Cc: stable@vger•kernel.org
>
> 8aa5a33578e9 is not in stable branches yet, so we don't need to Cc stable.
>
> > Fixes: 8aa5a33578e9 ("xsk: Add new statistics")
> > Suggested-by: Dan Carpenter <dan.carpenter@oracle•com>
> > Signed-off-by: Peilin Ye <yepeilin.cs@gmail•com>
> > ---
> > net/xdp/xsk.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> > index 26e3bba8c204..acf001908a0d 100644
> > --- a/net/xdp/xsk.c
> > +++ b/net/xdp/xsk.c
> > @@ -844,6 +844,8 @@ static int xsk_getsockopt(struct socket *sock, int level, int optname,
> > bool extra_stats = true;
> > size_t stats_size;
> >
> > + memset(&stats, 0, sizeof(stats));
> > +
>
> xsk.c doesn't include linux/string.h directly, so using memset may break
> build for some config combinations. We can probably just use
>
> struct xdp_statistics stats = {};
I see. I will send v2 soon. Thank you for reviewing the patch!
Peilin Ye
next prev parent reply other threads:[~2020-07-28 5:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 2:28 [Linux-kernel-mentees] [PATCH net] xdp: Prevent kernel-infoleak in xsk_getsockopt() Peilin Ye
2020-07-28 5:07 ` Song Liu
2020-07-28 5:25 ` Peilin Ye [this message]
2020-07-28 5:36 ` [Linux-kernel-mentees] [PATCH net v2] " Peilin Ye
2020-07-28 6:13 ` Björn Töpel
2020-07-28 6:15 ` Song Liu
2020-07-28 7:34 ` Arnd Bergmann
2020-07-28 10:53 ` Daniel Borkmann
2020-07-28 11:07 ` Peilin Ye
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=20200728052512.GA404005@PWN \
--to=yepeilin.cs@gmail$(echo .)com \
--cc=andriin@fb$(echo .)com \
--cc=arnd@arndb$(echo .)de \
--cc=ast@kernel$(echo .)org \
--cc=bjorn.topel@intel$(echo .)com \
--cc=bpf@vger$(echo .)kernel.org \
--cc=dan.carpenter@oracle$(echo .)com \
--cc=daniel@iogearbox$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=hawk@kernel$(echo .)org \
--cc=john.fastabend@gmail$(echo .)com \
--cc=jonathan.lemon@gmail$(echo .)com \
--cc=kafai@fb$(echo .)com \
--cc=kpsingh@chromium$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-kernel-mentees@lists$(echo .)linuxfoundation.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=magnus.karlsson@intel$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=song@kernel$(echo .)org \
--cc=songliubraving@fb$(echo .)com \
--cc=yhs@fb$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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