[Bug 881236] Re: valgrind on amd64 no longer works with 32-bit binaries
Loïc Minier
lool at dooz.org
Tue Oct 25 22:52:07 UTC 2011
Oh wow, sorry for the thinko, I actually typed gcc -m64 machinally
instead of -m32; indeed I can reproduce your issue with Ubuntu precise /
12.04 and -m32.
I also confirmed that the initial idea of installing libc6-dbg:i386 was
the right one, albeit it has conflicts.
After unpacking /usr/lib/debug/lib/i386-linux-gnu from
/libc6-dbg_2.13-20ubuntu5_i386.deb, valgrind passed.
So what this means is that since Ubuntu 11.10, you need to install the multiarch debugging symbols for libc on i386 before valgrind-ing 32-bits binaries on an amd64 system; theoritically this should be achieved with:
apt-get install libc6-dbg:i386
but this breaks with:
Unpacking libc6-dbg:i386 (from .../libc6-dbg_2.13-20ubuntu5_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/libc6-dbg_2.13-20ubuntu5_i386.deb (--unpack):
'./usr/lib/debug/usr/lib/pt_chown' is different from the same file on the system
due to file conflicts
I guess it means we need to break the debugging symbols into two
packages, libc-bin-dbg and libc6-dbg.
I don't think there is anything to change in valgrind as I can't think
of a way to automatically pull in valgrind's i386-debugging deps, so I'm
reassigning the bug to eglibc for the -dbg packaging changes.
Now, the -dbg packages come from Debian and should work in Ubuntu too, but Ubuntu has an additional -dbgsym repository which should have installable packages for i386 and amd64; theoritically, one should be able to add:
deb http://ddebs.ubuntu.com/ <your dist here> main restricted universe multiverse
to sources.list and then install libc6-dbgsym and libc6-dbgsym:i386; unfortunately this fails too because valgrind depends on libc6-dbg and libc6-dbg conflicts with libc6-dbgsym (on any arch); *sigh*.
However I confirmed that forcing the installation of libc6-dbgsym:i386 solved the problem too.
This is likely going to affect Debian too as it moves to multiarch.
** Package changed: valgrind (Ubuntu) => eglibc (Ubuntu)
--
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/881236
Title:
valgrind on amd64 no longer works with 32-bit binaries
Status in “eglibc” package in Ubuntu:
New
Bug description:
valgrind works as expected on 64-bit binaries, when using a x86-64 installation...
[icculus at taise ~]$ cat hello.c
#include <stdio.h>
int main(void) { printf("hello.\n"); return 0; }
[icculus at taise ~]$ gcc -m64 -o hello hello.c
[icculus at taise ~]$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
[icculus at taise ~]$ valgrind ./hello
==18291== Memcheck, a memory error detector
==18291== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==18291== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==18291== Command: ./hello
==18291==
hello.
==18291==
==18291== HEAP SUMMARY:
==18291== in use at exit: 0 bytes in 0 blocks
==18291== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==18291==
==18291== All heap blocks were freed -- no leaks are possible
==18291==
==18291== For counts of detected and suppressed errors, rerun with: -v
==18291== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
...however, it does not work with 32-bit binaries...
[icculus at taise ~]$ gcc -m32 -o hello hello.c
[icculus at taise ~]$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
[icculus at taise ~]$ valgrind ./hello
==18492== Memcheck, a memory error detector
==18492== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==18492== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==18492== Command: ./hello
==18492==
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: index
valgrind: in an object with soname matching: ld-linux.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux.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.
Please note that "lib6-dbg" is installed on this system...
[icculus at taise ~]$ sudo apt-get install libc6-dbg
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dbg is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
This worked with 32-bit binaries in the past (perhaps as recently as 11.04, but I can't say for certain).
This is happening on a fresh 11.04 x86-64 desktop install, default
Ubuntu (not Kubuntu, etc). There are some non-default packages
installed, like multilib-gcc, as you can tell by the "gcc -m32"
command line working, but I don't think these are causing issues.
Let me know if you need more information.
--ryan.
ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: valgrind 1:3.6.1-0ubuntu3
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 1.23-0ubuntu3
Architecture: amd64
Date: Tue Oct 25 01:13:48 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
ProcEnviron:
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: valgrind
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/881236/+subscriptions
More information about the foundations-bugs
mailing list