[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150921222538.GA31246@pox.localdomain>
Date: Tue, 22 Sep 2015 00:25:38 +0200
From: Thomas Graf <tgraf@...g.ch>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kcc@...gle.com,
andreyknvl@...gle.com, glider@...gle.com, ktsan@...glegroups.com,
paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH] lib: fix data race in rhashtable_rehash_one
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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists