From owner-svn-src-vendor@freebsd.org Wed Aug 29 17:50:58 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAA651090BC4; Wed, 29 Aug 2018 17:50:57 +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 4676F76EE7; Wed, 29 Aug 2018 17:50:56 +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 EE34F20683; Wed, 29 Aug 2018 17:50:55 +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 w7THotOx023336; Wed, 29 Aug 2018 17:50:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7THotsq023334; Wed, 29 Aug 2018 17:50:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201808291750.w7THotsq023334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Aug 2018 17:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r338382 - in vendor/compiler-rt/dist-release_70: lib/lsan test/lsan/TestCases/Linux X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/compiler-rt/dist-release_70: lib/lsan test/lsan/TestCases/Linux X-SVN-Commit-Revision: 338382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2018 17:50:58 -0000 Author: dim Date: Wed Aug 29 17:50:55 2018 New Revision: 338382 URL: https://svnweb.freebsd.org/changeset/base/338382 Log: Vendor import of compiler-rt release_70 branch r340910: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_70@340910 Added: vendor/compiler-rt/dist-release_70/test/lsan/TestCases/Linux/fork_and_leak.cc (contents, props changed) Deleted: vendor/compiler-rt/dist-release_70/test/lsan/TestCases/Linux/fork_with_threads.cc Modified: vendor/compiler-rt/dist-release_70/lib/lsan/lsan_common.cc Modified: vendor/compiler-rt/dist-release_70/lib/lsan/lsan_common.cc ============================================================================== --- vendor/compiler-rt/dist-release_70/lib/lsan/lsan_common.cc Wed Aug 29 17:50:52 2018 (r338381) +++ vendor/compiler-rt/dist-release_70/lib/lsan/lsan_common.cc Wed Aug 29 17:50:55 2018 (r338382) @@ -100,8 +100,6 @@ static SuppressionContext *GetSuppressionContext() { static InternalMmapVector *root_regions; -static uptr initialized_for_pid; - InternalMmapVector const *GetRootRegions() { return root_regions; } void InitializeRootRegions() { @@ -115,7 +113,6 @@ const char *MaybeCallLsanDefaultOptions() { } void InitCommonLsan() { - initialized_for_pid = internal_getpid(); InitializeRootRegions(); if (common_flags()->detect_leaks) { // Initialization which can fail or print warnings should only be done if @@ -571,12 +568,6 @@ static void CheckForLeaksCallback(const SuspendedThrea static bool CheckForLeaks() { if (&__lsan_is_turned_off && __lsan_is_turned_off()) return false; - if (initialized_for_pid != internal_getpid()) { - // If process was forked and it had threads we fail to detect references - // from other threads. - Report("WARNING: LeakSanitizer is disabled in forked process.\n"); - return false; - } EnsureMainThreadIDIsCorrect(); CheckForLeaksParam param; param.success = false; Added: vendor/compiler-rt/dist-release_70/test/lsan/TestCases/Linux/fork_and_leak.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist-release_70/test/lsan/TestCases/Linux/fork_and_leak.cc Wed Aug 29 17:50:55 2018 (r338382) @@ -0,0 +1,23 @@ +// Test that leaks detected after forking without exec(). +// RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s + +#include +#include +#include +#include + +int main() { + pid_t pid = fork(); + assert(pid >= 0); + if (pid > 0) { + int status = 0; + waitpid(pid, &status, 0); + assert(WIFEXITED(status)); + return WEXITSTATUS(status); + } else { + malloc(1337); + // CHECK: LeakSanitizer: detected memory leaks + } + return 0; +} +