All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neal Cardwell <ncardwell@google.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Cambda Zhu <cambda@linux.alibaba.com>,
	Yuchung Cheng <ycheng@google.com>
Subject: Re: [PATCH net] tcp: do not leave dangling pointers in tp->highest_sack
Date: Thu, 23 Jan 2020 13:30:11 -0500	[thread overview]
Message-ID: <CADVnQymsiHLv8N8QeEE-PSqYzB7KjZDwMHHkPtSgZpyW-C=RvQ@mail.gmail.com> (raw)
In-Reply-To: <20200123050300.29767-1-edumazet@google.com>

On Thu, Jan 23, 2020 at 12:03 AM Eric Dumazet <edumazet@google.com> wrote:
>
> Latest commit 853697504de0 ("tcp: Fix highest_sack and highest_sack_seq")
> apparently allowed syzbot to trigger various crashes in TCP stack [1]
>
> I believe this commit only made things easier for syzbot to find
> its way into triggering use-after-frees. But really the bugs
> could lead to bad TCP behavior or even plain crashes even for
> non malicious peers.
>
> I have audited all calls to tcp_rtx_queue_unlink() and
> tcp_rtx_queue_unlink_and_free() and made sure tp->highest_sack would be updated
> if we are removing from rtx queue the skb that tp->highest_sack points to.
>
> These updates were missing in three locations :
>
> 1) tcp_clean_rtx_queue() [This one seems quite serious,
>                           I have no idea why this was not caught earlier]
>
> 2) tcp_rtx_queue_purge() [Probably not a big deal for normal operations]
>
> 3) tcp_send_synack()     [Probably not a big deal for normal operations]
...
>
> Fixes: 853697504de0 ("tcp: Fix highest_sack and highest_sack_seq")
> Fixes: 50895b9de1d3 ("tcp: highest_sack fix")
> Fixes: 737ff314563c ("tcp: use sequence distance to detect reordering")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Cambda Zhu <cambda@linux.alibaba.com>
> Cc: Yuchung Cheng <ycheng@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> ---

Thanks, Eric! Indeed this seems to fix things so that now any time the
TCP code base calls either tcp_rtx_queue_unlink() or
tcp_rtx_queue_unlink_and_free() it has first taken care of updating
tp->highest_sack so that there is no dangling pointer.

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

  reply	other threads:[~2020-01-23 18:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  5:03 [PATCH net] tcp: do not leave dangling pointers in tp->highest_sack Eric Dumazet
2020-01-23 18:30 ` Neal Cardwell [this message]
2020-01-23 19:59 ` Yuchung Cheng
2020-01-24  8:10 ` David Miller

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='CADVnQymsiHLv8N8QeEE-PSqYzB7KjZDwMHHkPtSgZpyW-C=RvQ@mail.gmail.com' \
    --to=ncardwell@google.com \
    --cc=cambda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.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.