Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 214065 - >=dev-util/valgrind-3.3.0: failed redirect strlen on ppc/ppc64/amd64
Summary: >=dev-util/valgrind-3.3.0: failed redirect strlen on ppc/ppc64/amd64
Status: RESOLVED DUPLICATE of bug 390323
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: PPC64 Linux
: High normal with 1 vote (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
: 383173 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-20 17:32 UTC by Maik Nijhuis
Modified: 2012-09-14 11:23 UTC (History)
13 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,4.58 KB, text/plain)
2010-08-31 10:10 UTC, BlinkEye
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maik Nijhuis 2008-03-20 17:32:29 UTC
When I run valgrind 3.3.0 on my ppc64 processor (PlayStation 3 with Cell processor), I get an error message. The error message is the same regardless of the command I use behind 'valgrind'.

Reproducible: Always

Steps to Reproduce:
1.valgrind /bin/echo
2.
3.

Actual Results:  
==31213== Memcheck, a memory error detector.
==31213== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==31213== Using LibVEX rev 1804, a library for dynamic binary translation.
==31213== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==31213== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==31213== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==31213== For more details, rerun with: -v
==31213== 

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:   ld64.so.1
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld64.so.1
valgrind:  
valgrind:  Possible fix: install glibc's debuginfo package on this machine.
valgrind:  
valgrind:  Cannot continue -- exiting now.  Sorry.


Expected Results:  
Run echo and show there are no memory leaks :-)

I couldn't find any glibc debuginfo package in gentoo.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2008-03-20 17:41:35 UTC
emerge --info please...
Comment 2 Maurice van der Pot (RETIRED) gentoo-dev 2008-03-20 19:59:08 UTC
Also please locate ld64.so.1 and post the output of: nm /path/to/ld64.so.1|grep strlen
Comment 3 Maik Nijhuis 2008-03-21 08:26:34 UTC
Portage 2.1.4.4 (default-linux/ppc/ppc64/2007.0/64bit-userland, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-rc8-gf7767dc7 ppc64)
=================================================================
System uname: 2.6.23-rc8-gf7767dc7 ppc64 Cell Broadband Engine, altivec supported
Timestamp of tree: Wed, 19 Mar 2008 15:46:01 +0000
app-shells/bash:     3.2_p17
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="ppc64"
CBUILD="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=970 -mtune=970 -mabi=altivec"
CHOST="powerpc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -mcpu=970 -mtune=970 -mabi=altivec"
DISTDIR="/tmp/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.easynet.nl/mirror/gentoo/ http://gentoo.oregonstate.edu/ http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LINGUAS="en nl"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp/portage"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/toolchain /usr/portage/local/layman/cell /usr/local/overlays/lu_zero /usr/local/overlays/maik"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="X a52 acl altivec bash-completion bluetooth cli cracklib crypt dri dts dvd dvdread fbcon ftp gpm iconv ipv6 isdnlog live midi mudflap ncurses nls nptl nptlonly offensive openmp pam pcre perl ppc64 pppd profile readline reflection session slang spl ssl stroke symlink tcpd threads tiff unicode usb webdav x264 xorg xvid zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en nl" USERLAND="GNU" VIDEO_CARDS="dummy fbdev mach64 mga nv r128 radeon vega"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# nm /lib64/ld64.so.1
nm: /lib64/ld64.so.1: no symbols

(btw: Valgrind 3.2.3 works fine)
Comment 4 Fabian Groffen gentoo-dev 2008-03-21 18:32:11 UTC
with patch I get things like this:

/gentoo/prefix-tree//eclass/java-utils-2.eclass: line 2603: expected `)'
/usr/lib/portage/bin/ebuild.sh: /gentoo/prefix-tree//eclass/java-utils-2.eclass: 603: syntax error near `=~'

Two things here:

/usr/lib/portage/bin/ebuild.sh isn't prefix, and because of that, it doesn't use a prefix shell (hence an old bash)
Comment 5 Fabian Groffen gentoo-dev 2008-03-21 19:10:28 UTC
sorry folks, wrong tab ;)
Comment 6 Maurice van der Pot (RETIRED) gentoo-dev 2008-03-21 19:53:45 UTC
Toolchain: what do you think should happen?

I'll explain the problem:

On ppc32 & ppc64 valgrind needs to redirect the highly optimized strlen in ld*.so, because otherwise it will result in so many false positives that the results are unusable.
If ld is stripped (and splitdebug is not in FEATURES I guess) then valgrind cannot find strlen and will refuse to run altogether.

So basically, valgrind cannot be used on ppc if ld has been stripped.
Comment 7 SpanKY gentoo-dev 2008-03-23 16:21:00 UTC
sounds like you already have a solution: stick a warning into the ebuild.  i'd say the warning valgrind already emits is sufficient:
valgrind:  Possible fix: install glibc's debuginfo package on this machine.

but apparently whoever filed the bug didnt think so
Comment 8 Maik Nijhuis 2008-03-24 11:12:52 UTC
After adding splitdebug to my FEATURES, and recompiling glibc and valgrind 3.3.0, valgrind runs fine now. Thanks for your help!

So please make sure that the ebuild for valgrind will give a message that glibc should be built with splitdebug in the FEATURES when this is not the case on the ppc64 architecture.

Since many users do not know all FEATURES by heart, it is insufficient to only mention that the glibc debuginfo package should be installed, without telling that this should be done using a FEATURES flag.
Comment 9 Markus Rothe (RETIRED) gentoo-dev 2008-03-24 15:45:06 UTC
Is ppc64 the only arch suffering from this problem.

I think the error message from valgrind is sufficient.

griffion26: what do you think?
Comment 10 Maurice van der Pot (RETIRED) gentoo-dev 2008-03-24 19:44:59 UTC
It's ppc32 & ppc64. I'll put a warning in the ebuild for those platforms.
Comment 11 Maurice van der Pot (RETIRED) gentoo-dev 2008-04-30 10:15:54 UTC
This was fixed 25 March, I just forgot to mark this bug RESOLVED.
Comment 12 Alon Bar-Lev 2010-05-23 12:44:13 UTC
Note...

splitdebug in make.conf's FEATURES has too wide effect.

One can minimize the effect by adding
FEATURES="splitdebug" in /etc/portage/env/sys-libs/glibc
Comment 13 Stephan Menzel 2010-06-11 10:40:37 UTC
I got the same issue on amd64 so it isn't limited to ppc.
Comment 14 BlinkEye 2010-08-31 07:13:42 UTC
I confirm this is an amd64 issue as well:

# ebuild /usr/portage/sys-libs/glibc/glibc-2.11.2.ebuild compile
# nm ./build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so | grep strlen
0001cee0 d max_capstrlen
00017200 t strlen

# nm ./build-amd64-x86_64-pc-linux-gnu-nptl/elf/ld.so | grep strlen
000000000021cdb0 d max_capstrlen

and:

# file ./build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so
./build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

# file ./build-amd64-x86_64-pc-linux-gnu-nptl/elf/ld.so
./build-amd64-x86_64-pc-linux-gnu-nptl/elf/ld.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

So, only the 64bit elf/ld.so is missing the necessary strlen symbols. How can we add the symbols to the 64bit library?
Comment 15 BlinkEye 2010-08-31 07:14:34 UTC
Please reopen this bug, there's no solution yet
Comment 16 Maurice van der Pot (RETIRED) gentoo-dev 2010-08-31 09:17:09 UTC
Stephan: so you remerged glibc with splitdebug? What's the output of nm /usr/lib/debug/lib64/ld-2.12.1.so.debug (for the version of glibc you have)

Blinkeye: I can't tell what you did to get symbols in your ld.so.
Can you just emerge glibc with splitdebug?

I'm running on amd64 myself with glibc-2.12.1 and /usr/lib/debug/lib64/ld-2.12.1.so.debug does contain strlen on my system.
Comment 17 Maik Nijhuis 2010-08-31 09:42:41 UTC
Reopening at BlinkEye's request.

I can also confirm the issue at amd64, using valgrind 3.5.0.
Comment 18 Alon Bar-Lev 2010-08-31 09:52:59 UTC
As I wrote in comment#12, works for me.

[I--] [  ] dev-util/valgrind-3.5.0 (0)
[I--] [  ] sys-libs/glibc-2.11.2 (2.2)

# emerge --info
Portage 2.2_rc72 (default/linux/amd64/10.0/no-multilib, gcc-4.4.3, glibc-2.11.2-r0, 2.6.35-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.35-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9600_@_2.80GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 30 Aug 2010 01:45:01 +0000
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.2
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FSF-APPROVED @FSF-APPROVED-OTHER freedist Artistic"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -msse4.1 -fomit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -msse4.1 -fomit-frame-pointer -pipe"
DISTDIR="/var/gentoo/distfiles"
FEATURES="assume-digests distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox webrsync-gpg"
GENTOO_MIRRORS="http://mirror.isoc.org.il/pub/gentoo http://gentoo.osuosl.org"
LANG="he_IL.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en he"
MAKEOPTS="-j3"
PKGDIR="/var/gentoo/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/var/gentoo/portage"
PORTDIR_OVERLAY="/usr/local/portage/local /usr/local/portage/alon-barlev-portage /usr/local/portage/correlsense-gentoo-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa amd64 bidi bluetooth bzip2 caps cli cracklib crypt cups curl cxx dri fam gpm iconv ipv6 jpeg jpeg2k kde kerberos logrotate lzma mmx modules mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre png pppd qt3support qt4 readline reflection samba session spl sse sse2 ssl svg sysfs tcpd tiff unicode vim-syntax vorbis xinerama xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_anon authn_default authn_file authz_default authz_groupfile authz_host authz_user dav dir env expires mime rewrite" APACHE2_MPMS="prefork" ELIBC="glibc" FOO2ZJS_DEVICES="oki3200" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en he" QEMU_SOFTMMU_TARGETS="x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 19 BlinkEye 2010-08-31 10:08:12 UTC
(In reply to comment #16)
> Stephan: so you remerged glibc with splitdebug? What's the output of nm
> /usr/lib/debug/lib64/ld-2.12.1.so.debug (for the version of glibc you have)
> 

I emerged glibc-2.11.2 with splitdebug, and got no strlen symbol except:

# nm /usr/lib/debug/lib64/ld-2.11.2.so.debug |grep strlen
000000000021cdb0 d max_capstrlen

> I'm running on amd64 myself with glibc-2.12.1 and
> /usr/lib/debug/lib64/ld-2.12.1.so.debug does contain strlen on my system.
> 

Maybe glibc-2.12.1 is different?

Comment 20 BlinkEye 2010-08-31 10:10:32 UTC
Created attachment 245455 [details]
emerge --info
Comment 21 BlinkEye 2010-08-31 11:05:39 UTC
Further investigation reveals that the generated librtld.mk file of the amd64 build tree lacks the following line present in the x86 build tree:

rtld-string +=strlen.os

To verify:

# ebuild /usr/portage/sys-libs/glibc/glibc-2.11.2.ebuild compile

and compare 

# /var/portage/tmp/portage/sys-libs/glibc-2.11.2/work/build-amd64-x86_64-pc-linux-gnu-nptl/elf/librtld.mk

with

# /var/portage/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/librtld.mk

This librtld.mk file is generated by the elf/Makefile rule:

 336 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
 337         LC_ALL=C \
 338         sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
 339             $< | \
 340         while read lib file; do \
 341           case $$lib in \
 342           libc_pic.a) \
 343             LC_ALL=C fgrep -l /$$file \
 344                   $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
 345             LC_ALL=C \
 346             sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
 347             ;; \
 348           */*.a) \
 349             echo rtld-$${lib%%/*} += $$file ;; \
 350           *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
 351           esac; \
 352         done > $@T
 353         echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
 354                              | LC_ALL=C sort -u` >> $@T
 355         mv -f $@T $@
Comment 22 Alon Bar-Lev 2010-08-31 11:33:31 UTC
Just rebuilt glibc... still works...

$ nm /usr/lib/debug/lib64/ld-2.11.2.so.debug |grep strlen
0000000000016470 t __GI_strlen
000000000021ddb0 d max_capstrlen
0000000000016470 t strlen
Comment 23 BlinkEye 2010-08-31 11:52:38 UTC
(In reply to comment #22)
> Just rebuilt glibc... still works...
> 
> $ nm /usr/lib/debug/lib64/ld-2.11.2.so.debug |grep strlen
> 0000000000016470 t __GI_strlen
> 000000000021ddb0 d max_capstrlen
> 0000000000016470 t strlen
> 

Comparing our emerge --info output the only obvious difference seems to be that you're using a newer sys-apps/baselayout (2.0.1). The culprit might be a generated file and hence another library/tool might be the issue?
Comment 24 BlinkEye 2010-09-02 09:21:57 UTC
I built glibc-2.12.1-r1, and the strlen symbol is missing too:

# ebuild /usr/portage/sys-libs/glibc/glibc-2.12.1-r1.ebuild compile
# cd /var/portage/tmp/portage/sys-libs
# nm ./glibc-2.11.2/glibc-2.11.2/work/build-amd64-x86_64-pc-linux-gnu-nptl/elf/ld.so | grep strlen
000000000021cdb0 d max_capstrlen

# cd /var/portage/tmp/portage/sys-libs
# nm ./glibc-2.12.1-r1/work/build-amd64-x86_64-pc-linux-gnu-nptl/elf/ld.so | grep strlen
000000000021cdb0 d max_capstrlen
Comment 25 Bart Kus 2010-09-19 03:21:07 UTC
I also confirm error with valgrind-3.5.0 on amd64.


Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.34-gentoo-r1 x86_64)
=================================================================
System uname: Linux-2.6.34-gentoo-r1-x86_64-Intel-R-_Core-TM-2_Quad_CPU_@_2.40GHz-with-gentoo-1.12.13
Timestamp of tree: Sun, 19 Sep 2010 02:45:02 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.mirrors.tera-byte.com/ http://gentoo.arcticnetwork.ca/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X X509 acl acpi aliaschain amd64 apache2 async automount bash-completion berkdb bgpclassless bindist bzip2 cairo cgi clamav cli cnamefix cpudetection crypt cups curl cxx daemon dbus diskio djvu dri elf event-callback examples exif extras fat ffmpeg fix-connected-rt fortran gcj gd gdbm git gnutls gpm gtk hpn iconv imap inotify iproute2 ipv6 javascript jpeg jpeg2k kde kerberos libextractor lm_sensors loop-aes milter mmap mmx mng modules mp3 mudflap multidata multilib multipath multipleip mysql ncurses network nfs nfsv3 nfsv4 nls nptl nptlonly offensive opencore-amr opengl openmp pam parcheck pcre perl pkcs11 png pop pop3d pppd profile python qt3support qt4 raw readline realms reflection roundrobin rtc samba semanticfix sensord server session sieve smtp snmp sockets sql sse sse2 ssl svg sysfs syslog taglib tcpd threads tiff tokenizer truetype unicode user-homedirs vim-syntax vorbis webinterface webkit x264 xml xmlrpc xorg xulrunner xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 26 pat 2010-10-07 19:46:01 UTC
I can confirm this bug on ~amd64 with valgrind-3.5.0 as well. Also I can confirm that solution adding "debug" USE flag and "splitdebug" feature when building sys-libs/glibc-2.12.1-r1 fixes it.

emerge --info

Portage 2.1.9.13 (default/linux/amd64/10.0/desktop/gnome, gcc-4.4.4, glibc-2.12.1-r1, 2.6.36-rc4 x86_64)
=================================================================
System uname: Linux-2.6.36-rc4-x86_64-AMD_Turion-tm-_64_Mobile_Technology_MT-34-with-gentoo-2.0.1
Timestamp of tree: Thu, 07 Oct 2010 10:30:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p7
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-mtune=k8 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-mtune=k8 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.elen.ktu.lt/gentoo/"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdr cleartype cli consolekit corefonts cracklib crypt cups cxx dbus djvu dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fortran gdbm gdu gif gnome gnome-keyring gpm gstreamer gtk iconv ipv6 jpeg lcms ldap libnotify mad mikmod mmx mng modules mp3 mp4 mpeg mudflap multilib mysql nautilus ncurses networkmanager nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd pulseaudio python qt-static readline reflection sdl session spell sqlite sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype type1 udev unicode usb vorbis x264 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 27 BlinkEye 2010-10-08 06:28:05 UTC
(In reply to comment #26)
> I can confirm this bug on ~amd64 with valgrind-3.5.0 as well. Also I can
> confirm that solution adding "debug" USE flag and "splitdebug" feature when
> building sys-libs/glibc-2.12.1-r1 fixes it.
> 

But it does not work for the current stable glibc:

USE="debug" emerge sys-libs/glibc-2.11.2

(FEATURES="splitdebug" is set).

Is there a way to (safely) upgrade to sys-libs/glibc-2.12.1-r1 and then downgrade again?

Comment 28 BlinkEye 2010-10-21 11:44:13 UTC
Problem solved by:

- changing CFLAGS to "-march=native"
- adding "splitdebug" to FEATURES= variable in /etc/make.conf
- emerging glibc without any special useflags, e.g.

[ebuild   R   ] sys-libs/glibc-2.11.2  USE="(multilib) nls -debug -gd -glibc-omitfp (-hardened) -profile (-selinux) -vanilla" 0 kB

Verification:

$ nm /usr/lib/debug/lib64/ld-2.11.2.so.debug | grep strlen                                                                                                                                    
0000000000016430 t __GI_strlen
000000000021ddb0 d max_capstrlen
0000000000016430 t strlen

and

$ valgrind echo


Comment 29 Anthony Basile gentoo-dev 2010-11-14 01:43:52 UTC
(In reply to comment #28)
> Problem solved by:
> 
> - changing CFLAGS to "-march=native"
> - adding "splitdebug" to FEATURES= variable in /etc/make.conf
> - emerging glibc without any special useflags, e.g.
> 
> [ebuild   R   ] sys-libs/glibc-2.11.2  USE="(multilib) nls -debug -gd
> -glibc-omitfp (-hardened) -profile (-selinux) -vanilla" 0 kB
> 
> Verification:
> 
> $ nm /usr/lib/debug/lib64/ld-2.11.2.so.debug | grep strlen                      
> 0000000000016430 t __GI_strlen
> 000000000021ddb0 d max_capstrlen
> 0000000000016430 t strlen
> 
> and
> 
> $ valgrind echo
> 

Can you test your solution with valgrind-3.6.0 which just hit the tree.  It works fine for me with glibc-2.11.2 on amd64, but my test system is built with CFLAGS="-O2 -pipe -ggdb" and FEATURES="nostrip" which is overkill for most people.
Comment 30 BlinkEye 2010-11-17 06:46:10 UTC
(In reply to comment #29)
> 
> Can you test your solution with valgrind-3.6.0 which just hit the tree. ...

Same behaviour - it depends on CFLAGS. I do have an amd64 (Intel Core i7), and the following works:

CFLAGS="-march=core2 -mtune=generic -O2 -pipe"

as well as 

CFLAGS="-march=native"

What does not work are the "Safe Cflags" from the Gentoo Wiki for GCC < 4.3:

CFLAGS="-march=nocona -O2 -pipe"

Note: To get the desired effect (e.g. a working valgrind) you need to recompile both glibc and valgrind with the new CFLAGS.
Comment 31 Jeroen Roovers (RETIRED) gentoo-dev 2011-09-16 14:59:10 UTC
*** Bug 383173 has been marked as a duplicate of this bug. ***
Comment 32 Kamil Dudka 2011-09-16 15:51:24 UTC
This is just a consequence of incompetent fix of this bug:

https://bugs.kde.org/show_bug.cgi?id=190429#c11

Upstream mistakenly thinks it was fixed.  The redirection of strlen() should not be mandatory, no matter which version of glibc valgrind uses.  The issue is caused by optimizations in gcc, not by glibc.
Comment 33 Casper Ti. Vector 2011-12-03 13:43:13 UTC
Hello all.
I use the `splitdebug' FEATURE for glibc, but the bug is still encountered if `-fno-builtin-strlen' is not used.
One friend of mine suspected this was because I am using gcc 4.5.

===============================================================================
===============================================================================
******* Following is the result of `emerge --info gcc glibc valgrind'. ********
===============================================================================
===============================================================================

Portage 2.1.10.39 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.14.1-r1, 3.1.4-gentoo x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-3.1.4-gentoo-x86_64-Intel-R-_Pentium-R-_Dual_CPU_T2370_@_1.73GHz-with-gentoo-2.1
Timestamp of tree: Sat, 03 Dec 2011 12:15:01 +0000
app-shells/bash:          4.2_p20
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.6
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.11.1-r1
sys-devel/binutils:       2.22
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r1::caspervector
Repositories: gentoo gentoo-haskell gentoo-zh caspervector
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build n"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fakeroot fixlafiles metadata-transfer news parallel-fetch parallel-install protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersync"
FFLAGS=""
GENTOO_MIRRORS="http://mirror.bjtu.edu.cn/gentoo http://mirrors.ustc.edu.cn/gentoo"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--human-readable"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/haskell /var/lib/layman/gentoo-zh /usr/local/portage"
SYNC="rsync://mirrors.ustc.edu.cn/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fontconfig fortran gdu gif gnutls gpg gpm gtk iconv ipv6 jpeg lcms libedit libnotify mad maildir mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pango pcre pdf png policykit ppds pppd qt3support qt4 readline sdl session smp socks5 spell sse sse2 sse3 ssl ssse3 startup-notification svg sysfs system-sqlite tcpd threads tiff truetype udev unicode usb vorbis x264 xcb xft xinerama xml xorg xulrunner xv xvid zlib zsh-completion" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

=================================================================
                        Package Settings
=================================================================

sys-devel/gcc-4.5.3-r1 was built with the following:
USE="cxx fortran gcj mudflap (multilib) nls nptl openmp (-altivec) -bootstrap -build -doc (-fixed-point) -graphite -gtk (-hardened) (-libffi) -lto -multislot -nocxx -nopie -nossp -objc -objc++ -objc-gc -test -vanilla"


sys-libs/glibc-2.14.1-r1 was built with the following:
USE="(multilib) nls -debug -gd -glibc-omitfp (-hardened) -profile (-selinux) -vanilla"
CFLAGS="-g -march=nocona -pipe -O2 -fno-strict-aliasing -fno-builtin-strlen"
CXXFLAGS="-g -march=nocona -pipe -O2 -fno-strict-aliasing -fno-builtin-strlen"


dev-util/valgrind-3.7.0-r1 was built with the following:
USE="(multilib) -mpi"
CFLAGS="-g -march=nocona -O2 -pipe"
CXXFLAGS="-g -march=nocona -O2 -pipe"
Comment 34 Casper Ti. Vector 2011-12-03 13:47:07 UTC
Plus, the only difference between my `sys-libs/glibc' and that in Portage is the use of `-fno-builtin-strlen'.
Comment 35 Anthony Basile gentoo-dev 2011-12-03 22:31:20 UTC
(In reply to comment #34)
> Plus, the only difference between my `sys-libs/glibc' and that in Portage is
> the use of `-fno-builtin-strlen'.

This bug is back in 3.7.0.  See bug #390323.  I'm not going to mark the two reports as dups because its unclear at this point what versions and which arches are affected.  The suggestion in bug #390323 is that valgrind 3.6.1 is unaffected.  Can ppc64/ppc people can confirm this?
Comment 36 Anthony Basile gentoo-dev 2012-09-14 11:23:16 UTC
Now that I have access to ppc/ppc64 equipment, I'm sure this is a dup.

*** This bug has been marked as a duplicate of bug 390323 ***