Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1229991

Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one
Date 2015-09-22 11:10 +0200
Message-ID <qbrKi-Rt-7@gated-at.bofh.it> (permalink)
References <qbrAC-qV-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 2015-09-22 at 10:51 +0200, Dmitry Vyukov wrote:
> rhashtable_rehash_one() uses complex logic to update entry->next field,
> after INIT_RHT_NULLS_HEAD and NULLS_MARKER expansion:
> 
> entry->next = 1 | ((base + off) << 1)
> 
> This can be compiled along the lines of:
> 
> entry->next = base + off
> entry->next <<= 1
> entry->next |= 1
> 
> Which will break concurrent readers.
> 
> NULLS value recomputation is not needed here, so just remove
> the complex logic.
> 
> The data race was found with KernelThreadSanitizer (KTSAN).
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> ---

Thanks Dmitry

Acked-by: Eric Dumazet <edumazet@google.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] lib: fix data race in rhashtable_rehash_one Dmitry Vyukov <dvyukov@google.com> - 2015-09-22 11:00 +0200
  Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one Eric Dumazet <eric.dumazet@gmail.com> - 2015-09-22 11:10 +0200
  Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one Thomas Graf <tgraf@suug.ch> - 2015-09-22 11:20 +0200
  Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one Herbert Xu <herbert@gondor.apana.org.au> - 2015-09-22 17:30 +0200
  Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one David Miller <davem@davemloft.net> - 2015-09-23 02:40 +0200

csiph-web