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 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: References: X-Original-To: Dmitry Vyukov 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: 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 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 > --- Thanks Dmitry Acked-by: Eric Dumazet -- 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/