From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cJuyMkNNZ2IwRAEAbAwnHQ (envelope-from ) for ; Tue, 26 Apr 2022 03:39:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +GC/MkNNZ2IfJQAAauVa8A (envelope-from ) for ; Tue, 26 Apr 2022 03:39:15 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 121EF8A82 for ; Tue, 26 Apr 2022 03:39:14 +0200 (CEST) Received: from localhost ([::1]:53424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njAAb-0000WJ-Pr for larch@yhetil.org; Mon, 25 Apr 2022 21:39:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njAAR-0000Tu-2j for bug-guix@gnu.org; Mon, 25 Apr 2022 21:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njAAQ-00076H-Pu for bug-guix@gnu.org; Mon, 25 Apr 2022 21:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1njAAQ-00070I-OA for bug-guix@gnu.org; Mon, 25 Apr 2022 21:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Resent-From: Denis 'GNUtoo' Carikli Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 26 Apr 2022 01:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54728 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 54728@debbugs.gnu.org, ludo@gnu.org, maximedevos@telenet.be Received: via spool by 54728-submit@debbugs.gnu.org id=B54728.165093709126843 (code B ref 54728); Tue, 26 Apr 2022 01:39:02 +0000 Received: (at 54728) by debbugs.gnu.org; 26 Apr 2022 01:38:11 +0000 Received: from localhost ([127.0.0.1]:36473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njA9a-0006yn-8w for submit@debbugs.gnu.org; Mon, 25 Apr 2022 21:38:10 -0400 Received: from cyberdimension.org ([80.67.179.20]:60772 helo=gnutoo.cyberdimension.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njA9T-0006xv-FX for 54728@debbugs.gnu.org; Mon, 25 Apr 2022 21:38:04 -0400 Received: from gnutoo.cyberdimension.org (localhost [127.0.0.1]) by cyberdimension.org (OpenSMTPD) with ESMTP id fed584e9; Tue, 26 Apr 2022 01:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost [::1]) by gnutoo.cyberdimension.org (OpenSMTPD) with ESMTP id 4898a77f; Tue, 26 Apr 2022 01:31:54 +0000 (UTC) From: Denis 'GNUtoo' Carikli Date: Tue, 26 Apr 2022 03:39:13 +0200 Message-Id: <20220426013913.20117-3-GNUtoo@cyberdimension.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220426013913.20117-1-GNUtoo@cyberdimension.org> References: <2d69d3b032cea71f038fad9bacd7d060d323c110.camel@telenet.be> <20220426013913.20117-1-GNUtoo@cyberdimension.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Denis 'GNUtoo' Carikli Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650937155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=m4r58oauGcYmt6kFNshuco6ZoIf38xIaSSIQ+mxtRCY=; b=JwrFqUJzO7GA7/HnDc1yJAWUJU+GWZNzWkgVCGq+M7M/TDRkfm0Pb0qDTcZEyHaHUxYNdD qr5kVKtSZFnOXDpT68RucGPF9BRUItduyKSuJ3qeba6nk4vW+5lD35JJmPsg1+NTMBJAmn IYYTaEyo0nkTORN29wxXL2zlAkh0pmrH4lQ2FFCjYrojIYIdxPlB8gwWBeeFgHu9MC3es6 GELL/IbmnXOoPe1wYD3qOpp2B+I+GlTn7Xyjum1HJEcKzBKOnCJDVuMVFje1cHucUXFGlE Ocp2Q/WZzoXfWLtNMg2S5PSJsdhEFY6L+q8zHrH4agwIg1oX6Tddhyg0fd782A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650937155; a=rsa-sha256; cv=none; b=s9L9ylxwzdO9urElsjyXa7uXBqbhCi1Hj6+q82wX05kmV0T8t7n+pjZQIyqtW8JlyXuY3v 5QZGMS/Hxaq49KiRB+5UBveZ68LwxJyVHynFeIpWMzUNAfy7Pt39WeT0hoiGDhDgrvkKUG shrffaYb8IQ7SIBmChvTdWi3KKzVUmyLWviV/43DEyC9TAUSWlL9+MXOZN+sEcu8nTMs3j 7w17pe0wXHnMXoXvyb+QLdXxBTce6SATmL1RWnMPyBuciuAN1xDsyeUgR5umNNruKEYOa/ W8RCDG8NYf2hbmo7tTTHMV9wVN4rxsIemgFKysYHaM0R9W+q8O1N21hW5mXsvA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.51 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 121EF8A82 X-Spam-Score: -1.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: uWyDnfp2qlnA * gnu/packages/valgrind.scm (valgrind/interactive)[native-inputs]: Add libc:debug [arguments]: Add patch-default-debuginfo-path phase [source]: Add patch. (valgrind-3.18)[source]: Add patch. * gnu/packages/commencement.scm (glibc-final): Export variable. Signed-off-by: Denis 'GNUtoo' Carikli --- gnu/local.mk | 3 +- gnu/packages/commencement.scm | 2 +- .../valgrind-fix-default-debuginfo-path.patch | 100 ++++++++++++++++++ gnu/packages/valgrind.scm | 67 +++++++++++- 4 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9bad87710c..c28efcab32 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1919,7 +1919,8 @@ dist_patch_DATA = \ %D%/packages/patches/util-linux-tests.patch \ %D%/packages/patches/util-linux-CVE-2021-3995.patch \ %D%/packages/patches/util-linux-CVE-2021-3996.patch \ - %D%/packages/patches/valgrind-enable-arm.patch \ + %D%/packages/patches/valgrind-enable-arm.patch \ + %D%/packages/patches/valgrind-fix-default-debuginfo-path.patch \ %D%/packages/patches/vboot-utils-fix-format-load-address.patch \ %D%/packages/patches/vboot-utils-fix-tests-show-contents.patch \ %D%/packages/patches/vboot-utils-skip-test-workbuf.patch \ diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 1fed8bcd6e..769139e779 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3381,7 +3381,7 @@ (define gettext-boot0 (("^PROGRAMS =.*$") "PROGRAMS =\n"))))))))) -(define glibc-final +(define-public glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any. (package/inherit diff --git a/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch b/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch new file mode 100644 index 0000000000..f78dec02dc --- /dev/null +++ b/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch @@ -0,0 +1,100 @@ +From a7f17b57a94e9cde6d7fa96ac86be5c4fc4f9211 Mon Sep 17 00:00:00 2001 +From: Denis 'GNUtoo' Carikli +Date: Sun, 24 Apr 2022 22:20:50 +0200 +Subject: [PATCH] valgrind: fix default debuginfo path + +Description: Workaround for missing symbol in Guix's ld.so. The + correct fix (not stripping all the ld.so symbols) will be done in the + next Guix release as it requires to recompile a lot of packages. + +Forwarded: not-needed +Bug-Guix: https://issues.guix.gnu.org/54728 +Author: Denis 'GNUtoo' Carikli +--- + coregrind/m_debuginfo/readelf.c | 11 ++++++----- + docs/xml/manual-core-adv.xml | 4 ++-- + docs/xml/manual-core.xml | 2 +- + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c +index c586e3f33..947fcc500 100644 +--- a/coregrind/m_debuginfo/readelf.c ++++ b/coregrind/m_debuginfo/readelf.c +@@ -1509,9 +1509,9 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + if (buildid != NULL) { + debugpath = ML_(dinfo_zalloc)("di.fdf.1", +- VG_(strlen)(buildid) + 33); ++ VG_(strlen)(buildid) + DEBUGPATH_EXTRA_BYTES_1); + +- VG_(sprintf)(debugpath, "/usr/lib/debug/.build-id/%c%c/%s.debug", ++ VG_(sprintf)(debugpath, "DEFAULT_DEBUGINFO_PATH/.build-id/%c%c/%s.debug", + buildid[0], buildid[1], buildid + 2); + + dimg = open_debug_file(debugpath, buildid, 0, rel_ok, NULL); +@@ -1536,7 +1536,8 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + debugpath = ML_(dinfo_zalloc)( + "di.fdf.3", +- VG_(strlen)(objdir) + VG_(strlen)(debugname) + 64 ++ VG_(strlen)(objdir) + VG_(strlen)(debugname) ++ + VG_(strlen)("DEFAULT_DEBUGINFO_PATH/") + 1 + + (extrapath ? VG_(strlen)(extrapath) : 0) + + (serverpath ? VG_(strlen)(serverpath) : 0)); + +@@ -1561,7 +1562,7 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + TRY_OBJDIR_USRMERGE_OBJDIR("%s/%s"); + TRY_OBJDIR_USRMERGE_OBJDIR("%s/.debug/%s"); +- TRY_OBJDIR_USRMERGE_OBJDIR("/usr/lib/debug%s/%s"); ++ TRY_OBJDIR_USRMERGE_OBJDIR("DEFAULT_DEBUGINFO_PATH%s/%s"); + + if (extrapath) { + TRY_OBJDIR("%s%s/%s", extrapath, objdir, debugname); +@@ -1631,7 +1632,7 @@ DiImage* find_debug_file_ad_hoc( const DebugInfo* di, + + debugpath = ML_(dinfo_zalloc)( + "di.fdfah.3", +- VG_(strlen)(objdir) + 64 ++ VG_(strlen)(objdir) + DEBUGPATH_EXTRA_BYTES_2 + + (extrapath ? VG_(strlen)(extrapath) : 0) + + (serverpath ? VG_(strlen)(serverpath) : 0)); + +diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml +index 1fa801edc..a7c01d5e6 100644 +--- a/docs/xml/manual-core-adv.xml ++++ b/docs/xml/manual-core-adv.xml +@@ -447,7 +447,7 @@ Valgrind embedded gdbserver: + Remote debugging using | vgdb + relaying data between gdb and process 2418 + Reading symbols from /lib/ld-linux.so.2...done. +-Reading symbols from /usr/lib/debug/lib/ld-2.11.2.so.debug...done. ++Reading symbols from DEFAULT_DEBUGINFO_PATH/lib/ld-2.11.2.so.debug...done. + Loaded symbols for /lib/ld-linux.so.2 + [Switching to Thread 2418] + 0x001f2850 in _start () from /lib/ld-linux.so.2 +@@ -475,7 +475,7 @@ Remote communication error: Resource temporarily unavailable. + Remote debugging using | vgdb --pid=2479 + relaying data between gdb and process 2479 + Reading symbols from /lib/ld-linux.so.2...done. +-Reading symbols from /usr/lib/debug/lib/ld-2.11.2.so.debug...done. ++Reading symbols from DEFAULT_DEBUGINFO_PATH/lib/ld-2.11.2.so.debug...done. + Loaded symbols for /lib/ld-linux.so.2 + [Switching to Thread 2479] + 0x001f2850 in _start () from /lib/ld-linux.so.2 +diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml +index dc33e1269..f6eb60086 100644 +--- a/docs/xml/manual-core.xml ++++ b/docs/xml/manual-core.xml +@@ -1409,7 +1409,7 @@ that can report errors, e.g. Memcheck, but not Cachegrind. + + By default Valgrind searches in several well-known paths + for debug objects, such +- as /usr/lib/debug/. ++ as DEFAULT_DEBUGINFO_PATH/. + + However, there may be scenarios where you may wish to put + debug objects at an arbitrary location, such as external storage +-- +2.35.1 + diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 6648f17dfa..1269e07593 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -25,9 +25,12 @@ (define-module (gnu packages valgrind) #:use-module (guix build-system gnu) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix licenses) #:use-module (guix packages) + #:use-module (guix utils) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages gdb) #:use-module (gnu packages perl)) @@ -93,9 +96,68 @@ (define-public valgrind (define-public valgrind/interactive (package/inherit valgrind + (version "3.17.0") + (source (origin + (method url-fetch) + (uri (list (string-append "https://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2") + (string-append "ftp://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2"))) + (sha256 + (base32 + "18l5jbk301j3462gipqn9bkfx44mdmwn0pwr73r40gl1irkfqfmd")) + (patches (search-patches + "valgrind-enable-arm.patch" + "valgrind-fix-default-debuginfo-path.patch")))) (inputs ;; GDB is needed to provide a sane default for `--db-command'. - `(("gdb" ,gdb))) + `(("gdb" ,gdb) + ("glibc:debug" ,(canonical-package glibc) "debug"))) + (arguments + (substitute-keyword-arguments (package-arguments valgrind) + ((#:phases those-phases #~%standard-phases) + #~(let* ((those-phases #$those-phases) + (unpack (assoc-ref those-phases 'unpack))) + (modify-phases + those-phases + (add-before 'configure 'patch-default-debuginfo-path + (lambda _ + ;; This helps Valgrind find the debug symbols of ld.so. + ;; Without it, Valgrind does not work in a Guix shell + ;; container and cannot be used as-is during packages tests + ;; phases + (substitute* ' + ("coregrind/m_debuginfo/readelf.c" + "docs/xml/manual-core-adv.xml" + "docs/xml/manual-core.xml") + (("DEFAULT_DEBUGINFO_PATH") + (string-append (assoc-ref %build-inputs "glibc:debug") + "/lib/debug"))) + ;; We also need to account for the bigger path in + ;; the malloc-ed variables + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_1") + (number->string + (+ (string-length + (string-append + (assoc-ref %build-inputs "glibc:debug") + "/lib/debug")) + (string-length "/.build-id//.debug") + 1)))) + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_2") + (number->string + (+ (string-length + (string-append + (assoc-ref + %build-inputs + "glibc:debug") + "/lib/debug")) + (string-length + "/usr/lib/debug") + 1))))))))))) (properties '()))) (define-public valgrind-3.18 @@ -111,4 +173,5 @@ (define-public valgrind-3.18 (sha256 (base32 "1xgph509i6adv9w2glviw3xrmlz0dssg8992hbvxsbkp7ahrm180")) - (patches (search-patches "valgrind-enable-arm.patch")))))) + (patches (search-patches "valgrind-enable-arm.patch" + "valgrind-fix-default-debuginfo-path.patch")))))) -- 2.35.1