[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190424190413.GC17274@pc-2.home>
Date: Wed, 24 Apr 2019 21:04:13 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
James Chapman <jchapman@...alix.com>
Subject: Re: [PATCH net] l2tp: use rcu_dereference_sk_user_data() in
l2tp_udp_encap_recv()
On Wed, Apr 24, 2019 at 11:29:25AM -0700, Eric Dumazet wrote:
> On Wed, Apr 24, 2019 at 11:21 AM Guillaume Nault <gnault@...hat.com> wrote:
>
> >
> > And then, we'd need to make sure that ->sk_user_data is in sync with
> > the encap_rcv() callback (or whatever actually uses the data pointed
> > to). Otherwise a module could treat ->sk_user_data as a struct foo
> > pointer while it actually points to a struct bar.
> >
> > For example, a quick look at net/sunrpc/svcsock.c seems to indicate
> > that svc_addsock() would accept any (unconnected) UDP socket and pass
> > it to svc_addsock(), which in turn would override ->sk_user_data with
> > a struct svc_sock pointer. If the socket was previously set up by L2TP,
> > then we'd end up with ->sk_user_data pointing to a svc_sock structure,
> > but ->encap_rcv still pointing to l2tp_udp_encap_recv(). That's going
> > to give unexpected results when l2tp_udp_encap_recv() will dereference
> > ->sk_user_data to access (what it believes to be) its tunnel structure.
>
> A full audit is needed, and I have started it. If you want to help
> just send a patch ;)
>
> I have looked at this l2tp code only after fixing another issue in
> RXRPC, and would have
> looked later at SUNRPC.
Hum, sorry, I didn't realise that. I'm really interested in the
solutions you can come up with.
Powered by blists - more mailing lists