From: James Chapman <jchapman@katalix.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, gnault@redhat.com
Subject: Re: [PATCH net] l2tp: add sk_reuseport checks to l2tp_validate_socket
Date: Wed, 8 Jul 2020 11:23:06 +0100 [thread overview]
Message-ID: <20200708102306.GB26371@katalix.com> (raw)
In-Reply-To: <20200707183128.owsu62mnxp3k6lae@kafai-mbp>
On Tue, Jul 07, 2020 at 11:31:28 -0700, Martin KaFai Lau wrote:
> On Mon, Jul 06, 2020 at 12:45:36PM -0700, David Miller wrote:
> > From: James Chapman <jchapman@katalix.com>
> > Date: Mon, 6 Jul 2020 13:12:59 +0100
> >
> > > The crash occurs in the socket destroy path. bpf_sk_reuseport_detach
> > > assumes ownership of sk_user_data if sk_reuseport is set and writes a
> > > NULL pointer to the memory pointed to by
> > > sk_user_data. bpf_sk_reuseport_detach is called via
> > > udp_lib_unhash. l2tp does its socket cleanup through sk_destruct,
> > > which fetches private data through sk_user_data. The BUG_ON fires
> > > because this data has been corrupted.
> >
> > The ownership of sk_user_data has to be handled more cleanly.
> >
> > BPF really has no business taking over this as it is for the protocols
> > to use and what L2TP is doing is quite natural and normal. Exactly
> > what sk_user_data was designed to be used for.
> >
> > I'm not applying this, please take this up with the BPF folks. They
> > need to store their metadata elsewhere.
> Thanks for the report.
>
> The sk_user_data is used when a sk is added to the bpf's reuseport_sockarray.
> Before it can be added, the bpf side does check if the sk_user_data has already been
> used or not. It is the similar check like other usages on sk_user_data.
>
> The missing part is the reuseport_detach_sock() should check if a
> sk is currently in a reuseport_sockarray before calling bpf_sk_reuseport_detach().
> It can be solved by remembering if a sk is added to the reuseport_sockarray.
> I will work on a fix by doing this.
Thanks Martin.
prev parent reply other threads:[~2020-07-08 10:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 12:12 [PATCH net] l2tp: add sk_reuseport checks to l2tp_validate_socket James Chapman
2020-07-06 19:45 ` David Miller
2020-07-07 18:31 ` Martin KaFai Lau
2020-07-08 10:23 ` James Chapman [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=20200708102306.GB26371@katalix.com \
--to=jchapman@katalix.com \
--cc=davem@davemloft.net \
--cc=gnault@redhat.com \
--cc=kafai@fb.com \
--cc=netdev@vger.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.