From owner-svn-src-projects@freebsd.org Fri Jan 12 18:16:53 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23D9AE74003 for ; Fri, 12 Jan 2018 18:16:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3157782EA; Fri, 12 Jan 2018 18:16:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 386B2272E9; Fri, 12 Jan 2018 18:16:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CIGpfM067895; Fri, 12 Jan 2018 18:16:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CIGprK067894; Fri, 12 Jan 2018 18:16:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801121816.w0CIGprK067894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 12 Jan 2018 18:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r327884 - projects/clang600-import/contrib/llvm/tools/lld/ELF X-SVN-Group: projects X-SVN-Commit-Author: dim X-SVN-Commit-Paths: projects/clang600-import/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 327884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 18:16:53 -0000 Author: dim Date: Fri Jan 12 18:16:51 2018 New Revision: 327884 URL: https://svnweb.freebsd.org/changeset/base/327884 Log: Pull in r322264 from upstream lld trunk (by me): Fix thread race between SectionPiece's OutputOff and Live members Summary: As reported in bug 35788, rL316280 reintroduces a race between two members of SectionPiece, which share the same 64 bit memory location. To fix the race, check the hash before checking the Live member, as suggested by Rafael. Reviewers: ruiu, rafael Reviewed By: ruiu Subscribers: smeenai, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D41884 Modified: projects/clang600-import/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp Modified: projects/clang600-import/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp Fri Jan 12 17:36:19 2018 (r327883) +++ projects/clang600-import/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp Fri Jan 12 18:16:51 2018 (r327884) @@ -2435,10 +2435,8 @@ void MergeNoTailSection::finalizeContents() { parallelForEachN(0, Concurrency, [&](size_t ThreadId) { for (MergeInputSection *Sec : Sections) { for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) { - if (!Sec->Pieces[I].Live) - continue; size_t ShardId = getShardId(Sec->Pieces[I].Hash); - if ((ShardId & (Concurrency - 1)) == ThreadId) + if ((ShardId & (Concurrency - 1)) == ThreadId && Sec->Pieces[I].Live) Sec->Pieces[I].OutputOff = Shards[ShardId].add(Sec->getData(I)); } }