Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1596567
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net] dccp/tcp: fix routing redirect race |
| Date | 2017-03-10 03:30 +0100 |
| Message-ID | <tjitA-5sB-7@gated-at.bofh.it> (permalink) |
| References | <tiUUi-6eM-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Jon Maxwell <jmaxwell37@gmail.com>
Date: Thu, 9 Mar 2017 12:15:21 +1100
> We have seen a few incidents lately where a dst_enty has been freed
> with a dangling TCP socket reference (sk->sk_dst_cache) pointing to that
> dst_entry. If the conditions/timings are right a crash then ensues when the
> freed dst_entry is referenced later on. A Common crashing back trace is:
...
> A closer look at the tcp_v4_err() handler revealed that do_redirect() will run
> regardless of whether user space has the socket locked. This can result in a
> race condition where the same dst_entry cached in sk->sk_dst_entry can be
> decremented twice for the same socket via:
>
> do_redirect()->__sk_dst_check()-> dst_release().
>
> Which leads to the dst_entry being prematurely freed with another socket
> pointing to it via sk->sk_dst_cache and a subsequent crash.
>
> To fix this skip do_redirect() if usespace has the socket locked. Instead let
> the redirect take place later when user space does not have the socket
> locked.
>
> The dccp code is very similar in this respect, so fixing it there too.
>
> As Eric Garver pointed out the following commit now invalidates routes. Which
> can set the dst->obsolete flag so that ipv4_dst_check() returns null and
> triggers the dst_release().
>
> Fixes: ceb3320610d6 ("ipv4: Kill routes during PMTU/redirect updates.")
> Cc: Eric Garver <egarver@redhat.com>
> Cc: Hannes Sowa <hsowa@redhat.com>
> Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
Please add the ipv6 side of this fix to this patch and repost.
Thank you.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH net] dccp/tcp: fix routing redirect race Jon Maxwell <jmaxwell37@gmail.com> - 2017-03-09 02:20 +0100
Re: [PATCH net] dccp/tcp: fix routing redirect race Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-09 03:40 +0100
Re: [PATCH net] dccp/tcp: fix routing redirect race Jonathan Maxwell <jmaxwell37@gmail.com> - 2017-03-09 04:50 +0100
Re: [PATCH net] dccp/tcp: fix routing redirect race Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-09 05:50 +0100
Re: [PATCH net] dccp/tcp: fix routing redirect race Jonathan Maxwell <jmaxwell37@gmail.com> - 2017-03-09 06:00 +0100
Re: [PATCH net] dccp/tcp: fix routing redirect race David Miller <davem@davemloft.net> - 2017-03-10 03:30 +0100
csiph-web