From nobody Sun Nov 21 09:40:09 2021 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1315B189160A; Sun, 21 Nov 2021 09:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HxlkK7452z3kqG; Sun, 21 Nov 2021 09:40:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8CB148E6; Sun, 21 Nov 2021 09:40:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AL9e9Pq080198; Sun, 21 Nov 2021 09:40:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AL9e9pw080196; Sun, 21 Nov 2021 09:40:09 GMT (envelope-from git) Date: Sun, 21 Nov 2021 09:40:09 GMT Message-Id: <202111210940.1AL9e9pw080196@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 5184b149d8e9 - main - devel/google-perftools: Add a more reliable way to detect that the process is run under Valgrind List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5184b149d8e9b847715bb2fb787527c52616de24 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=5184b149d8e9b847715bb2fb787527c52616de24 commit 5184b149d8e9b847715bb2fb787527c52616de24 Author: Yuri Victorovich AuthorDate: 2021-11-21 09:37:41 +0000 Commit: Yuri Victorovich CommitDate: 2021-11-21 09:40:05 +0000 devel/google-perftools: Add a more reliable way to detect that the process is run under Valgrind --- devel/google-perftools/Makefile | 2 +- .../files/patch-src_base_dynamic__annotations.c | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/devel/google-perftools/Makefile b/devel/google-perftools/Makefile index 0c0ebbb68dba..f8b0d79c6900 100644 --- a/devel/google-perftools/Makefile +++ b/devel/google-perftools/Makefile @@ -3,7 +3,7 @@ PORTNAME= google-perftools DISTVERSIONPREFIX= gperftools- DISTVERSION= 2.9.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= https://github.com/gperftools/gperftools/releases/download/gperftools-${PORTVERSION}/ DISTNAME= gperftools-${PORTVERSION} diff --git a/devel/google-perftools/files/patch-src_base_dynamic__annotations.c b/devel/google-perftools/files/patch-src_base_dynamic__annotations.c new file mode 100644 index 000000000000..e02b1a5f5afe --- /dev/null +++ b/devel/google-perftools/files/patch-src_base_dynamic__annotations.c @@ -0,0 +1,37 @@ +- add another way to determine if the process is run under valgrind - based on LD_PRELOAD patterns presence +- Submitted: https://github.com/gperftools/gperftools/pull/1316 + +--- src/base/dynamic_annotations.c.orig 2021-02-15 06:44:21 UTC ++++ src/base/dynamic_annotations.c +@@ -43,6 +43,19 @@ + #include "base/dynamic_annotations.h" + #include "getenv_safe.h" // for TCMallocGetenvSafe + ++static int running_on_valgrind_preload = -1; ++void __attribute__ ((constructor)) premain() { ++ char *LD_PRELOAD = getenv("LD_PRELOAD"); ++ running_on_valgrind_preload = LD_PRELOAD != NULL && ++ ( ++ strstr(LD_PRELOAD, "/valgrind/") != NULL ++ || ++ strstr(LD_PRELOAD, "/vgpreload") != NULL ++ ) ++ ? ++ 1 : 0; ++} ++ + static int GetRunningOnValgrind(void) { + #ifdef RUNNING_ON_VALGRIND + if (RUNNING_ON_VALGRIND) return 1; +@@ -51,6 +64,11 @@ static int GetRunningOnValgrind(void) { + if (running_on_valgrind_str) { + return strcmp(running_on_valgrind_str, "0") != 0; + } ++ ++ // use the LD_PRELOAD trick from https://stackoverflow.com/questions/365458/how-can-i-detect-if-a-program-is-running-from-within-valgrind ++ if (running_on_valgrind_preload == 1) ++ return 1; ++ + return 0; + } +