[Bug 1247026] Re: valgrind does not work on amd64 (strlen missing)
Rajesh
1247026 at bugs.launchpad.net
Thu Jan 4 07:20:04 UTC 2018
Hi All,
I am facing with valgrind as below. Please let me know the solution for
it.
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ uname -r
4.10.0-42-generic
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ sudo make clean
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ sudo ./configure --host=powerpc-pc-linux LDFLAGS=-static CC=/opt/ELDK42/usr/bin/ppc_85xx-gcc CXX=/opt/ELDK42/usr/bin/ppc_85xx-g++ --enable-tls --prefix=/home/rajeshsingh/valgrind_bins/ --exec-prefix=/home/rajeshsingh/valgrind_bins
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ sudo make
rajeshsingh at rajesh-dt:~/Downloads/valgrind-3.13.0$ sudo make install
After that I am makeing this as tar.gz file and copying on device and
uncomprees it.
On Device:
tar -xjvf valgrind.tar.gz
mv valgrind_bins/bin/valgrind /etc/bin/
cp valgrind_bins/lib/valgrind/default.supp /etc/lib/valgrind/
VALGRIND_LIB=/tmp/valgrind_bins/lib/valgrind/
export VALGRIND_LIB
/etc/bin/valgrind ls
O/P:
bash-4.3# /etc/bin/valgrind ls
==1797== Memcheck, a memory error detector
==1797== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1797== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1797== Command: ls
==1797==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld.so.1
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld.so.1
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Note that if you are debugging a 32 bit process on a
valgrind: 64 bit system, you will need a corresponding 32 bit debuginfo
valgrind: package (e.g. libc6-dbg:i386).
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
bash-4.3#
I added some check in m_redir.c file and compile and loaded valgrind.
+#if CI_HACK_strlen
add_hardwired_spec(
"ld.so.1", "strlen",
(Addr)&VG_(ppc32_linux_REDIR_FOR_strlen),
complain_about_stripped_glibc_ldso
);
+#endif
bash-4.3# mv valgrind_bins/bin/valgrind /etc/bin/
/default.supp /etc/lib/valgrind/
VALGRIND_LIB=/tmp/valgrind_bins/lib/valgrind/
export VALGRIND_LIBbash-4.3# cp valgrind_bins/lib/valgrind/default.supp /etc/lib/valgrind/
cp: can't create '/etc/lib/valgrind/': No such file or directory
bash-4.3# VALGRIND_LIB=/tmp/valgrind_bins/lib/valgrind/
bash-4.3# export VALGRIND_LIB
bash-4.3# /etc/bin/valgrind ls
==1836== Memcheck, a memory error detector
==1836== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1836== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1836== Command: ls
==1836==
==1836== Conditional jump or move depends on uninitialised value(s)
==1836== at 0x4002820: ??? (in /lib/ld-2.6.so)
==1836== by 0x4015693: ??? (in /lib/ld-2.6.so)
==1836==
==1836== Conditional jump or move depends on uninitialised value(s)
==1836== at 0x4002854: ??? (in /lib/ld-2.6.so)
==1836== by 0x4015693: ??? (in /lib/ld-2.6.so)
==1836==
disInstr(ppc): found an AltiVec or an e500 instruction 0x13C17320
that can't be handled by Valgrind. If this instruction is an
Altivec instruction, Valgrind must be run on a host that supportsAltiVec instructions. If the application was compiled for e500, then
unfortunately Valgrind does not yet support e500 instructions.
==1836== valgrind: Unrecognised instruction at address 0x400df78.
==1836== at 0x400DF78: ??? (in /lib/ld-2.6.so)
==1836== Your program just tried to execute an instruction that Valgrind
==1836== did not recognise. There are two possible reasons for this.
==1836== 1. Your program has a bug and erroneously jumped to a non-code
==1836== location. If you are running Memcheck and you just saw a
==1836== warning about a bad jump, it's probably your program's fault.
==1836== 2. The instruction is legitimate but Valgrind doesn't handle it,
==1836== i.e. it's Valgrind's fault. If you think this is the case or
==1836== you are not sure, please let us know and we'll try to fix it.
==1836== Either way, Valgrind will now raise a SIGILL signal which will
==1836== probably kill your program.
==1836==
==1836== Process terminating with default action of signal 4 (SIGILL)
==1836== Illegal opcode at address 0x400DF78
==1836== at 0x400DF78: ??? (in /lib/ld-2.6.so)
==1836==
==1836== HEAP SUMMARY:
==1836== in use at exit: 0 bytes in 0 blocks
==1836== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==1836==
==1836== All heap blocks were freed -- no leaks are possible
==1836==
==1836== For counts of detected and suppressed errors, rerun with: -v
==1836== Use --track-origins=yes to see where uninitialised values come from
==1836== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 0 from 0)
Illegal instruction
bash-4.3#
bash-4.3#
Please let me know how to comeout from this issue ?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to valgrind in Ubuntu.
https://bugs.launchpad.net/bugs/1247026
Title:
valgrind does not work on amd64 (strlen missing)
Status in Valgrind:
Unknown
Status in glibc package in Ubuntu:
Confirmed
Status in valgrind package in Ubuntu:
Confirmed
Bug description:
It seems that strlen has been inlined in the amd64 version of glibc
currently used in Ubuntu 13.10 (saucy). This makes it impossible to
run valgrind. It fails with the following output:
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux-x86-64.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
Either the glibc package needs to be fixed so it does not inline
strlen or valgrind needs to be fixed. A work-around patch to valgrind
can be found in this thread:
https://bugs.kde.org/show_bug.cgi?id=286864
To manage notifications about this bug go to:
https://bugs.launchpad.net/valgrind/+bug/1247026/+subscriptions
More information about the foundations-bugs
mailing list