From nobody Sat Jan 13 08:18:50 2024 X-Original-To: dev-commits-ports-main@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 4TBrs65tT3z574rv; Sat, 13 Jan 2024 08:18:50 +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 4TBrs64kQ8z4fKK; Sat, 13 Jan 2024 08:18:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705133930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=edIwosIur1CdtYodYhNc7hu7U0yjfACZlo4isge/4no=; b=fPu8qpXK2YMuno0Cmq3p9iAYywsVTyrWGkSleMYEKl9gcIrdHeB/dlw1dDm/GNbs1h5L7u fVcvh3I7OxRuEQIobNzvnhOBa/m5TolI/umGvigMAkJmObjEJO2M/lrSA1ksEl/oud2k3Q Na1HFptLHD7244jcKHGD056RrRdiEELEvUFs5l7h4BZUa+F7haADNRGnlVArbIe5UB+C2c 08XevfidVvlwPlH21pvQ7ON3AyaoCdr/FPRFa/jebo+I9zHoZ27F9Y3ZV5W4xHUPODUE7e 0M9Jk4gDVKjXko8EpGm2/Jj4WNEEFQMmuMotOMbXG9/u8KeoFRuEJRHRfXJKJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705133930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=edIwosIur1CdtYodYhNc7hu7U0yjfACZlo4isge/4no=; b=pzb9VcYZJa9j11jMhNfRql4u6eKWOgFVPU7/QYvBH43cKJVseHgiadIZ2byUxEZip5y5FX 5dPFnzROFgbym3KjoXQYK9S1IMFKpa3Z7Vq2OJnd/RgaQt9ylZYek50jvdNZigzEOLZYTL KlqUdKedd+ZxnuXyRC9b5P/+lem2vHPjctaA2aBRl8rF9s9sN3gosSvu5uqXAiI2SHXAhc ykU0DNCPLhOjeogXG0PCGVtc5E8eItq5Ium2hcd8kvvgIg6Ffs7FA+lMxxHoNw557wZBd9 1nNbW+pC0rLrNqjQjJTgeHzLA7FsWj72b6SiNk9odrg4WZDlIyiwguqWjelpEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705133930; a=rsa-sha256; cv=none; b=N+thiuTbbJeNUQ4MKIx1Qc57ubqQ2nBO7yGmwKTyQyVOIa7O59HJ2BlmdZwJ3oaC/7GSHX 9Q9y9ARUgk+CSfxOQ9q4xWkAE9ijWywOIEaG2ZJkmmcXX+wx9CI1x/ukHCiphpQYqux3Gy vXNEVYKg5hAMCd8vyeSjX06zyfgMxbefjLxdGSjcf+h6e23x7389nmrNu5HEbBUBR8E7Cp akUkWx3nk5cXquWR4rw8gTSs8+8N84asBUrugmjULK/cGDf+WSsBtr1Y+Qaf+79ZDxyyWg qxPL7OdUc2mXww9XvkQ931fGdyg/9tUIds91kyTVXUx4aDPfAgXdhC4R2CnNtQ== 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 4TBrs63n5fzMSl; Sat, 13 Jan 2024 08:18:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40D8Iooc050918; Sat, 13 Jan 2024 08:18:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40D8Io8V050915; Sat, 13 Jan 2024 08:18:50 GMT (envelope-from git) Date: Sat, 13 Jan 2024 08:18:50 GMT Message-Id: <202401130818.40D8Io8V050915@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Lorenzo Salvadore Subject: git: 99c1ed39b70e - main - lang/gcc14-devel: Fix Address sanitizer List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: salvadore X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99c1ed39b70e5c82b3d8d0b01eac6e4ab8438693 Auto-Submitted: auto-generated The branch main has been updated by salvadore: URL: https://cgit.FreeBSD.org/ports/commit/?id=99c1ed39b70e5c82b3d8d0b01eac6e4ab8438693 commit 99c1ed39b70e5c82b3d8d0b01eac6e4ab8438693 Author: Lorenzo Salvadore AuthorDate: 2024-01-12 14:25:09 +0000 Commit: Lorenzo Salvadore CommitDate: 2024-01-13 08:18:27 +0000 lang/gcc14-devel: Fix Address sanitizer Software compiled with -fsanitize=address fails to run with the error message "ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD". This commit fixes the issue by ignoring the [vdso] loaded shared library instead of linux-vdso.so. PR: 267751 Reported by: yuri Co-authored-by: Andreas Tobler --- lang/gcc14-devel/Makefile | 1 + .../files/patch-libsanitizer_asan_asan__linux.cpp | 23 ++++++++++++++++++++++ .../files/patch-libsanitizer_asan_asan__thread.cpp | 13 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/lang/gcc14-devel/Makefile b/lang/gcc14-devel/Makefile index 8bfc79d7d740..f92cfaef452d 100644 --- a/lang/gcc14-devel/Makefile +++ b/lang/gcc14-devel/Makefile @@ -1,5 +1,6 @@ PORTNAME= gcc PORTVERSION= 14.0.0.s20240107 +PORTREVISION= 1 CATEGORIES= lang MASTER_SITES= GCC/snapshots/${DIST_VERSION} PKGNAMESUFFIX= ${SUFFIX}-devel diff --git a/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__linux.cpp b/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__linux.cpp new file mode 100644 index 000000000000..f6c16d8730ee --- /dev/null +++ b/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__linux.cpp @@ -0,0 +1,23 @@ +Since the vDSO shared librares on Linux and FreeBSD are called +differently, the initialization order check fails on FreeBSD. +This patch fixes it by ignoring [vdso] instead of linux-vdso.so. + +GCC gets the original file from the LLVM Project, so this patch should +probably be upstreamed directly to the LLVM Project rather than to GCC. + + +--- libsanitizer/asan/asan_linux.cpp.orig 2022-11-23 11:22:41 UTC ++++ libsanitizer/asan/asan_linux.cpp +@@ -148,6 +148,12 @@ static int FindFirstDSOCallback(struct dl_phdr_info *i + return 0; + # endif + ++# if SANITIZER_FREEBSD ++ // Ignore vDSO ++ if (internal_strncmp(info->dlpi_name, "[vdso]", sizeof("[vdso]") - 1) == 0) ++ return 0; ++# endif ++ + *name = info->dlpi_name; + return 1; + } diff --git a/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__thread.cpp b/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__thread.cpp new file mode 100644 index 000000000000..61c0ccf1cd89 --- /dev/null +++ b/lang/gcc14-devel/files/patch-libsanitizer_asan_asan__thread.cpp @@ -0,0 +1,13 @@ +--- libsanitizer/asan/asan_thread.cpp.orig 2024-01-12 13:45:52 UTC ++++ libsanitizer/asan/asan_thread.cpp +@@ -323,7 +323,9 @@ void AsanThread::ClearShadowForThreadStackAndTLS() { + if (tls_begin_ != tls_end_) { + uptr tls_begin_aligned = RoundDownTo(tls_begin_, ASAN_SHADOW_GRANULARITY); + uptr tls_end_aligned = RoundUpTo(tls_end_, ASAN_SHADOW_GRANULARITY); +- FastPoisonShadow(tls_begin_aligned, tls_end_aligned - tls_begin_aligned, 0); ++ FastPoisonShadowPartialRightRedzone(tls_begin_aligned, ++ tls_end_ - tls_begin_aligned, ++ tls_end_aligned - tls_end_, 0); + } + } +