Date: Wed, 29 Aug 2018 17:50:55 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> 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 Message-ID: <201808291750.w7THotsq023334@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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<RootRegion> *root_regions; -static uptr initialized_for_pid; - InternalMmapVector<RootRegion> 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 <assert.h> +#include <stdlib.h> +#include <sys/wait.h> +#include <unistd.h> + +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; +} +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808291750.w7THotsq023334>