[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200701213735.GA13349@gondor.apana.org.au>
Date: Thu, 2 Jul 2020 07:37:35 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Marco Elver <elver@...gle.com>
Subject: Re: [PATCH v2 net] tcp: md5: refine
tcp_md5_do_add()/tcp_md5_hash_key() barriers
On Wed, Jul 01, 2020 at 11:43:04AM -0700, Eric Dumazet wrote:
> My prior fix went a bit too far, according to Herbert and Mathieu.
>
> Since we accept that concurrent TCP MD5 lookups might see inconsistent
> keys, we can use READ_ONCE()/WRITE_ONCE() instead of smp_rmb()/smp_wmb()
>
> Clearing all key->key[] is needed to avoid possible KMSAN reports,
> if key->keylen is increased. Since tcp_md5_do_add() is not fast path,
> using __GFP_ZERO to clear all struct tcp_md5sig_key is simpler.
>
> data_race() was added in linux-5.8 and will prevent KCSAN reports,
> this can safely be removed in stable backports, if data_race() is
> not yet backported.
>
> v2: use data_race() both in tcp_md5_hash_key() and tcp_md5_do_add()
>
> Fixes: 6a2febec338d ("tcp: md5: add missing memory barriers in tcp_md5_do_add()/tcp_md5_hash_key()")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Herbert Xu <herbert@...dor.apana.org.au>
> Cc: Marco Elver <elver@...gle.com>
> ---
> net/ipv4/tcp.c | 8 ++++----
> net/ipv4/tcp_ipv4.c | 19 ++++++++++++++-----
> 2 files changed, 18 insertions(+), 9 deletions(-)
Acked-by: Herbert Xu <herbert@...dor.apana.org.au>
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists