All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: fw@strlen.de
Cc: netdev@vger.kernel.org, cpaasch@apple.com, pabeni@redhat.com
Subject: Re: [PATCH net] mptcp: fix use-after-free on tcp fallback
Date: Wed, 05 Feb 2020 14:08:35 +0100 (CET)	[thread overview]
Message-ID: <20200205.140835.1375589051372133185.davem@davemloft.net> (raw)
In-Reply-To: <20200204171230.618-1-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Tue,  4 Feb 2020 18:12:30 +0100

> When an mptcp socket connects to a tcp peer or when a middlebox interferes
> with tcp options, mptcp needs to fall back to plain tcp.
> Problem is that mptcp is trying to be too clever in this case:
> 
> It attempts to close the mptcp meta sk and transparently replace it with
> the (only) subflow tcp sk.
> 
> Unfortunately, this is racy -- the socket is already exposed to userspace.
> Any parallel calls to send/recv/setsockopt etc. can cause use-after-free:
> 
> BUG: KASAN: use-after-free in atomic_try_cmpxchg include/asm-generic/atomic-instrumented.h:693 [inline]
 ...
> While the use-after-free can be resolved, there is another problem:
> sock->ops and sock->sk assignments are not atomic, i.e. we may get calls
> into mptcp functions with sock->sk already pointing at the subflow socket,
> or calls into tcp functions with a mptcp meta sk.
> 
> Remove the fallback code and call the relevant functions for the (only)
> subflow in case the mptcp socket is connected to tcp peer.
> 
> Reported-by: Christoph Paasch <cpaasch@apple.com>
> Diagnosed-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied, thanks Florian.

      parent reply	other threads:[~2020-02-05 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 17:12 [PATCH net] mptcp: fix use-after-free on tcp fallback Florian Westphal
2020-02-04 17:44 ` Mat Martineau
2020-02-04 18:05 ` Christoph Paasch
2020-02-05 13:08 ` David Miller [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=20200205.140835.1375589051372133185.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=cpaasch@apple.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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.