Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1229797
| From | Thomas Graf <tgraf@suug.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] lib: fix data race in rhashtable_rehash_one |
| Date | 2015-09-22 00:30 +0200 |
| Message-ID | <qbhKV-3ep-7@gated-at.bofh.it> (permalink) |
| References | <qb4kH-Od-25@gated-at.bofh.it> <qb9u3-83M-29@gated-at.bofh.it> <qbaJt-1m5-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 09/21/15 at 07:51am, Eric Dumazet wrote: > The important part here is that we rehash an item, so we need to make > sure to maintain consistent ->next field, and need to prevent compiler > from using ->next as a temporary variable. > > ptr->next = 1UL | ((base + offset) << 1); > > Is dangerous because compiler could issue : > > ptr->next = (base + offset); > > ptr->next <<= 1; > > ptr->next += 1UL; > > Frankly, all this looks like an oversight in this code. > > Not sure why the NULLS value is even recomputed. The hash of the chain is part of the NULLS value. Since the entry might have been moved to a different chain, the NULLS value must be recalculated to contain the proper hash. However, nobody is using the hash today as far as I can see so we could as well just remove it and use the base value only for the nulls marker. -- 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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] lib: fix data race in rhashtable_rehash_one Dmitry Vyukov <dvyukov@google.com> - 2015-09-21 10:10 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Eric Dumazet <eric.dumazet@gmail.com> - 2015-09-21 15:40 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Eric Dumazet <eric.dumazet@gmail.com> - 2015-09-21 17:00 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Eric Dumazet <eric.dumazet@gmail.com> - 2015-09-21 17:20 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Dmitry Vyukov <dvyukov@google.com> - 2015-09-21 17:20 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Thomas Graf <tgraf@suug.ch> - 2015-09-22 00:30 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Eric Dumazet <eric.dumazet@gmail.com> - 2015-09-22 01:10 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Thomas Graf <tgraf@suug.ch> - 2015-09-22 10:30 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Dmitry Vyukov <dvyukov@google.com> - 2015-09-22 11:00 +0200
Re: [PATCH] lib: fix data race in rhashtable_rehash_one Herbert Xu <herbert@gondor.apana.org.au> - 2015-09-22 17:20 +0200
csiph-web