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

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] lib: fix data race in rhashtable_rehash_one
Date Tue, 22 Sep 2015 11:10:02 +0200
Message-ID <qbrKi-Rt-7@gated-at.bofh.it> (permalink)
References <qbrAC-qV-21@gated-at.bofh.it>
X-Original-To Dmitry Vyukov <dvyukov@google.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=nRVuAysPpzOS6mM+s6iDwndBqZkldyTbLPWIrHGajtI=; b=boxVz/LwhhGSj0gZXVIiSl91Y2IMunDpH6lhFovaX2iS4hoAoRnCCmqoYXZLTX4WtZ 4AdCDFo8hrq/KWLgLTCqUwZrjeFPEGxLZ2agCLvWYKqUNmpKIXdk0wipaXH2z8m011yn +iFLVcydjUQS7gn4/bu82XCGYpGKq6lMbbJNuPw/5MEXevXSn4/82AJUCZxMff0Kucw4 Pl61nDFz8inWfkIU8nyFrIKJxrepnTSJAq/3lxVO18+a1a/BVgOIh/ad8+0qoLfNTMYg LBP9R1kq540cES372TW+XjIx1cofM7cS07/rOaDONUja1uHsEG/6iTpmb3pj8gzPuSXm LXxQ==
X-Received by 10.66.190.135 with SMTP id gq7mr30608228pac.65.1442912712024; Tue, 22 Sep 2015 02:05:12 -0700 (PDT)
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.10.4-0ubuntu2
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc netdev@vger.kernel.org, linux-kernel@vger.kernel.org, tgraf@suug.ch, kcc@google.com, andreyknvl@google.com, glider@google.com, ktsan@googlegroups.com, paulmck@linux.vnet.ibm.com
X-Original-Date Tue, 22 Sep 2015 02:05:10 -0700
X-Original-Message-ID <1442912710.29850.75.camel@edumazet-glaptop2.roam.corp.google.com>
X-Original-References <1442911912-66882-1-git-send-email-dvyukov@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1229991

Show key headers only | 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