[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADVnQymsiHLv8N8QeEE-PSqYzB7KjZDwMHHkPtSgZpyW-C=RvQ@mail.gmail.com>
Date: Thu, 23 Jan 2020 13:30:11 -0500
From: Neal Cardwell <ncardwell@...gle.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>,
Cambda Zhu <cambda@...ux.alibaba.com>,
Yuchung Cheng <ycheng@...gle.com>
Subject: Re: [PATCH net] tcp: do not leave dangling pointers in tp->highest_sack
On Thu, Jan 23, 2020 at 12:03 AM Eric Dumazet <edumazet@...gle.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@...gle.com>
> Cc: Cambda Zhu <cambda@...ux.alibaba.com>
> Cc: Yuchung Cheng <ycheng@...gle.com>
> Cc: Neal Cardwell <ncardwell@...gle.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@...gle.com>
neal
Powered by blists - more mailing lists