Bug 87598 - valgrind-2.4.0 segfaults no matter what I do
Bug#: 87598 Product:  Gentoo Linux Version: unspecified Platform: x86
OS/Version: Linux Status: RESOLVED Severity: major Priority: P2
Resolution: FIXED Assigned To: griffon26@gentoo.org Reported By: aaron@cs.tu-berlin.de
Component: Unspecified
URL: 
Summary: valgrind-2.4.0 segfaults no matter what I do
Keywords:  
Status Whiteboard: 
Opened: 2005-04-01 13:51 0000
Description:   Opened: 2005-04-01 13:51 0000
I haven't found the cause yet, but whatever I do, my valgrind segfaults...

aaron@therion ~ $ valgrind
Segmentation fault


Reproducible: Always
Steps to Reproduce:

Actual Results:  
valgrind segfaulting... 

Expected Results:  
valgrind supporting me in finding possible bugs in my code 

therion aaron # emerge info 
Portage 2.0.51.19 (default-linux/x86/2004.3, gcc-3.4.3-20050110, 
glibc-2.3.4.20050125-r1, 2.6.11-gentoo-r4 i686) 
================================================================= 
System uname: 2.6.11-gentoo-r4 i686 AMD Athlon(tm) XP 2000+ 
Gentoo Base System version 1.6.10 
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Mar 29 2005, 23:58:21)] 
dev-lang/python:     2.3.5 
sys-devel/autoconf:  2.13, 2.59-r6 
sys-devel/automake:  1.5, 1.8.5-r3, 1.7.9-r1, 1.6.3, 1.4_p6, 1.9.5 
sys-devel/binutils:  2.15.92.0.2-r7 
sys-devel/libtool:   1.5.14 
virtual/os-headers:  2.6.8.1-r4 
ACCEPT_KEYWORDS="x86 ~x86" 
AUTOCLEAN="yes" 
CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer" 
CHOST="i686-pc-linux-gnu" 
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms" 
GENTOO_MIRRORS="ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo 
ftp://pandemonium.tiscali.de/pub/gentoo/" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" 
USE="x86 3dnow 3dnowex X aac aalib acpi acpi4linux alsa apache2 apm arts avi 
bash-completion berkdb bitmap-fonts cdr chroot codecs crypt cups curl dba dga 
directfb divx4linux dlloader dts dvd dvdread emboss encode erandom faac faad 
fam fbcon ffmpeg flac font-server foomaticdb fortran freetype gd gdbm gif 
gphoto2 gpm graphviz gtk2 hal imagemagick imlib ipv6 java jpeg jpeg2k junit kde 
libcaca libg++ libwww mad matroska mikmod mime mjpegmpeg mmx mmxext mng motif 
mp3 mpeg mpeg4 mplayer ncurses network nls nptl nvidia oggvorbis opengl oss pam 
pdflib perl php pic pie png python qt quicktime readline real rtc samba sdl 
slang spell sqlite sse ssl stencil-buffer svga sysfs tcpd tga theora tiff 
toolbari truetype truetype-fonts type1 type1-fonts unicode usb userlocales 
vim-with-x vorbis xine xml2 xmms xv xvid xvmc zlib linguas_de" 
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY

------- Comment #1 From Maurice van der Pot 2005-04-02 04:10:58 0000 -------
I'll look into it in a few days. For now, I have masked 2.4.0.

------- Comment #2 From Olaf Freyer 2005-04-02 10:49:34 0000 -------
ok... today I have played arround with this ebuild a bit....
even if I do: CFLAGS="" emerge valgrind
the resulting valgrind segfaults for me...

BUT if I remove the line from the valgrind-2.4.0 ebuild where we force it to respect $CFLAGS,  I get a version working just fine. So I presume the sed-magic messes up something in the configure file...

so concluding I can say: removing 
    sed -i -e 's:CFLAGS="-Wno-long-long":CFLAGS="$CFLAGS -Wno-long-long":' configure
from the ebuild made me have a working valgrind....

------- Comment #3 From Maurice van der Pot 2005-04-05 10:44:07 0000 -------
Just to log here what we know: adding --disable-pie to configure will also
result in a working build of valgrind.

I'll be looking into the CFLAGS thing you mentioned.

------- Comment #4 From Maurice van der Pot 2005-04-05 13:42:23 0000 -------
Battousai, I added you to the cc because you may be interested in this one.

Solar, you've helped me before when I expressed my cluelessness when it comes to PIE. I could use your help again if that's ok. 

The thing is that the valgrind developers are trying to use PIE (iirc because they want valgrind to be able to run itself). Unfortunately, valgrind's tests do not run with hardened gcc (see http://bugs.kde.org/show_bug.cgi?id=96321), so I filter -fPIC, causing -fnopie to be added to CFLAGS. This in turn makes it impossible for valgrind to use PIE, so I have to configure it with --disable-pie (otherwise it will segfault).

Is there a way to get around the reserved BREG without completely disabling PIE? 

------- Comment #5 From Maurice van der Pot 2005-04-12 11:40:58 0000 -------
I just checked in a version that should work fine even with PIE.
Thanks for the report Olaf.

------- Comment #6 From Olaf Freyer 2005-04-12 12:23:25 0000 -------
thanks for your efforts..
just tested it and it works perfect!

------- Comment #7 From Gregorio Guidi (RETIRED) 2005-05-11 02:54:26 0000 -------
*** Bug 88138 has been marked as a duplicate of this bug. ***