unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: 54728@debbugs.gnu.org, ludo@gnu.org, maximedevos@telenet.be
Subject: bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found
Date: Tue, 26 Apr 2022 03:39:11 +0200	[thread overview]
Message-ID: <20220426013913.20117-1-GNUtoo@cyberdimension.org> (raw)
In-Reply-To: <2d69d3b032cea71f038fad9bacd7d060d323c110.camel@telenet.be>


Hi,

I've now managed to make a proper patch. I've used 'v2' for more
clarity.

I'll send the files used to test them in a subsequent mails.

As for the tests, I've done them in Guix system, once installed
valgrind works fine:
> $ make check
> valgrind -v --leak-check=full ./main
> ==20324== Memcheck, a memory error detector
> ==20324== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==20324== Using Valgrind-3.18.1-42b08ed5bd-20211015 and LibVEX; rerun with -h for copyright info
> ==20324== Command: ./main
> ==20324== 
> --20324-- Valgrind options:
> --20324--    -v
> --20324--    --leak-check=full
> --20324-- Contents of /proc/version:
> --20324--   Linux version 5.16.20-gnu (guix@guix) (gcc (GCC) 10.3.0, GNU ld (GNU Binutils) 2.37) #1 SMP PREEMPT 1
> --20324-- 
> --20324-- Arch and hwcaps: X86, LittleEndian, x86-mmxext-sse1-sse2-sse3
> --20324-- Page sizes: currently 4096, max supported 4096
> --20324-- Valgrind library directory: /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind
> --20324-- Reading syms from /gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/ld-2.33.so
> --20324--   Considering /gnu/store/wznq4d1i3znqjhcribfr2m9ljyyrsdyd-glibc-2.33-debug/lib/debug/gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/ld-2.33.so.debug ..
> --20324--   .. CRC is valid
> --20324-- Reading syms from /home/gnutoo/work/projects/guix/valgrind-test/main
> --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/memcheck-x86-linux
> --20324--    object doesn't have a symbol table
> --20324--    object doesn't have a dynamic symbol table
> --20324-- Scheduler: using generic scheduler lock implementation.
> --20324-- Reading suppressions file: /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/default.supp
> ==20324== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-20324-by-gnutoo-on-???
> ==20324== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-20324-by-gnutoo-on-???
> ==20324== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-20324-by-gnutoo-on-???
> ==20324== 
> ==20324== TO CONTROL THIS PROCESS USING vgdb (which you probably
> ==20324== don't want to do, unless you know exactly what you're doing,
> ==20324== or are doing some strange experiment):
> ==20324==   /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/../../bin/vgdb --pid=20324 ...command...
> ==20324== 
> ==20324== TO DEBUG THIS PROCESS USING GDB: start GDB like this
> ==20324==   /path/to/gdb ./main
> ==20324== and then give GDB the following command
> ==20324==   target remote | /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/../../bin/vgdb --pid=20324
> ==20324== --pid is optional if only one valgrind process is running
> ==20324== 
> --20324-- REDIR: 0x4021570 (ld-linux.so.2:strlen) redirected to 0x580a1f4a (???)
> --20324-- REDIR: 0x40212d0 (ld-linux.so.2:index) redirected to 0x580a1f25 (???)
> --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/vgpreload_core-x86-linux.so
> --20324--    object doesn't have a symbol table
> --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/vgpreload_memcheck-x86-linux.so
> --20324--    object doesn't have a symbol table
> ==20324== WARNING: new redirection conflicts with existing -- ignoring it
> --20324--     old: 0x04021570 (strlen              ) R-> (0000.0) 0x580a1f4a ???
> --20324--     new: 0x04021570 (strlen              ) R-> (2007.0) 0x04043ca0 strlen
> --20324-- Reading syms from /gnu/store/r7n4snily34ld9nm4crzc0z65jr2y26c-gcc-10.3.0-lib/lib/libgcc_s.so.1
> --20324--    object doesn't have a symbol table
> --20324-- Reading syms from /gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/libc-2.33.so
> --20324--   Considering /gnu/store/wznq4d1i3znqjhcribfr2m9ljyyrsdyd-glibc-2.33-debug/lib/debug/gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/libc-2.33.so.debug ..
> --20324--   .. CRC is valid
> ==20324== WARNING: new redirection conflicts with existing -- ignoring it
> --20324--     old: 0x040f08c0 (memalign            ) R-> (1011.0) 0x04043084 memalign
> --20324--     new: 0x040f08c0 (memalign            ) R-> (1017.0) 0x0404303d aligned_alloc
> ==20324== WARNING: new redirection conflicts with existing -- ignoring it
> --20324--     old: 0x040f08c0 (memalign            ) R-> (1011.0) 0x04043084 memalign
> --20324--     new: 0x040f08c0 (memalign            ) R-> (1017.0) 0x04042ff6 aligned_alloc
> ==20324== WARNING: new redirection conflicts with existing -- ignoring it
> --20324--     old: 0x040f08c0 (memalign            ) R-> (1011.0) 0x04043084 memalign
> --20324--     new: 0x040f08c0 (memalign            ) R-> (1017.0) 0x0404303d aligned_alloc
> ==20324== WARNING: new redirection conflicts with existing -- ignoring it
> --20324--     old: 0x040f08c0 (memalign            ) R-> (1011.0) 0x04043084 memalign
> --20324--     new: 0x040f08c0 (memalign            ) R-> (1017.0) 0x04042ff6 aligned_alloc
> --20324-- REDIR: 0x40f49e0 (libc.so.6:strncasecmp) redirected to 0x40351e6 (_vgnU_ifunc_wrapper)
> --20324-- REDIR: 0x40fa870 (libc.so.6:memrchr) redirected to 0x40351e6 (_vgnU_ifunc_wrapper)
> --20324-- REDIR: 0x410df30 (libc.so.6:wcslen) redirected to 0x40351e6 (_vgnU_ifunc_wrapper)
> --20324-- REDIR: 0x410d5c0 (libc.so.6:__GI_strrchr) redirected to 0x4043730 (__GI_strrchr)
> --20324-- REDIR: 0x410da60 (libc.so.6:__GI_strlen) redirected to 0x4043c20 (__GI_strlen)
> --20324-- REDIR: 0x40efb60 (libc.so.6:malloc) redirected to 0x403e5ae (malloc)
> Hello world
> --20324-- REDIR: 0x40f0190 (libc.so.6:free) redirected to 0x40409fc (free)
> ==20324== 
> ==20324== HEAP SUMMARY:
> ==20324==     in use at exit: 0 bytes in 0 blocks
> ==20324==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
> ==20324== 
> ==20324== All heap blocks were freed -- no leaks are possible
> ==20324== 
> ==20324== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 5)
> --20324-- 
> --20324-- used_suppression:      5 dl-hack3-cond-1 /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/default.supp:1232
> ==20324== 
> ==20324== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 5)

In addition it also works fine with either valgrind/interactive or
valgrind-3.18 as dependency, when it is used in the tests of a
package.

I've used the 'make && ./pre-inst-env guix build -f
libsamsung-ipc.scm' command for that (with a libsamsung-ipc.scm that
is slightly modified since last time).

Denis.




  reply	other threads:[~2022-04-26  1:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 15:01 bug#54728: Valgrind not working out of the box due to stripped ld.so Denis 'GNUtoo' Carikli
2022-04-07 16:40 ` Ludovic Courtès
2022-04-14 23:26   ` Denis 'GNUtoo' Carikli
2022-04-14 23:30     ` bug#54728: [PATCH 1/2] gnu: valgrind: impots: sort imports alphabetically Denis 'GNUtoo' Carikli
2022-04-14 23:30       ` bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Denis 'GNUtoo' Carikli
2022-04-15 16:21         ` Ludovic Courtès
2022-04-25 16:39           ` Denis 'GNUtoo' Carikli
2022-04-25 17:41             ` Maxime Devos
2022-04-26  1:39               ` Denis 'GNUtoo' Carikli [this message]
2022-04-26  1:39                 ` bug#54728: [PATCH v2 1/2] gnu: valgrind: impots: sort imports alphabetically Denis 'GNUtoo' Carikli
2022-04-26  1:39                 ` bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Denis 'GNUtoo' Carikli
2022-04-26 22:37                   ` Denis 'GNUtoo' Carikli
2022-05-06 20:16                     ` Denis 'GNUtoo' Carikli
2022-05-06 20:20                       ` Maxime Devos
2022-05-09  9:24                   ` bug#54728: Valgrind not working out of the box due to stripped ld.so Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220426013913.20117-1-GNUtoo@cyberdimension.org \
    --to=gnutoo@cyberdimension.org \
    --cc=54728@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).