Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
glibc detected free(): invalid pointer:
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 657

PostPosted: Thu Mar 31, 2005 7:04 pm    Post subject: glibc detected free(): invalid pointer: Reply with quote

What do I need to re-emerge to fix this problem? I'm getting this on mysql-administrator and smbc-1.2.1.
Code:
$ mysql-administrator
*** glibc detected *** free(): invalid pointer: 0x081c80f0 ***
/usr/bin/mysql-administrator: line 9:  4127 Aborted                 $MYPATH/mysql-administrator-bin

Thanks.
Code:
emerge info
Portage 2.0.51.19 (default-linux/x86/2004.0, 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 mobile AMD Athlon(tm) XP-M 2000+
Gentoo Base System version 1.6.10
Python:              dev-lang/python-2.4-r3 [2.4 (#1, Mar 19 2005, 19:14:05)]
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
dev-lang/python:     2.4-r3
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 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 -mtune=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /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/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -mtune=athlon-xp -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distcc distlocks sfperms"
GENTOO_MIRRORS="ftp://mirrors.tds.net/gentoo http://mirror.datapipe.net/gentoo http://mirrors.tds.net/gentoo"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/overlays/bmg-main /usr/local/overlays/fluidportage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 3dnow S3TC X aac aalib acl acpi adns aim alsa apache2 apm arts avi bash-completion berkdb bitmap-fonts bluetooth bonobo caps cddb cdf cdr chroot cle266 crypt cups curl dba dbus dga directfb divx4linux dv dvd dvdr emacs emboss encode esd evo expat faad fam fastcgi fbcon fbdev ffmpeg flac flash fluidsynth fmod font-server foomaticdb fortran freetds freetype fs gcj gd gdbm geoip ggi gif gimp gimpprint glade glut gnome gnomedb gphoto2 gpm gps graphviz gstreamer gtk gtk2 gtkhtml guile hal hbci icq ieee1394 imagemagick imap imlib imlib2 innodb jabber jack jack-tmpfs jpeg lcd lcms ldap libclamav libg++ libgda libwww lirc lua mad mbox md5sum mdb mikmod mmx mng mono mozdevelop mozilla moznocompose moznoirc moznomail mozsvg mozxmlterm mp3 mpeg mpeg4 msn mssql mysql nas ncurses nls nntp nodrm nomotif nptl odbc ofx oggvorbis openal opengl opie oscar oss pam pcmcia pcre pda pdflib perl plotutils png pnp postgis postgres psyco pthreads python qt quicktime readline rogue ruby samba sasl scanner sdl slang speedo speex spell sqlite sse ssl stencil-buffer svg svga tcpd tetex theora tiff transcode truetype truetype-fonts type1 type1-fonts unichrome usb v4l v4l2 vda vhosts virus-scan wmf wxwin wxwindows xine xml xml2 xmms xprint xv xvid yahoo yv12 zeo zlib zvbi video_cards_via"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS
Back to top
View user's profile Send private message
ehud
n00b
n00b


Joined: 15 May 2004
Posts: 69
Location: Tel Aviv

PostPosted: Fri Apr 01, 2005 4:34 pm    Post subject: Reply with quote

The error you are seeing shows that there's a bug in mysql-administrator.

You can tell glibc to ignore the error and try to resume. Try this:

Code:
MALLOC_CHECK_=1 mysql-administrator


or if you're using tcsh:

setenv MALLOC_CHECK_ 1
mysql-administrator
Back to top
View user's profile Send private message
Yasw
n00b
n00b


Joined: 13 Jul 2004
Posts: 3

PostPosted: Wed Apr 13, 2005 8:14 am    Post subject: Reply with quote

I got the same problem with gtksee and wmmisc after an glibc update. When i downgraded to glibc-20040808 the problem dissapeared, so the logical conclusion would be that something is wrong with glibc, or what?
Back to top
View user's profile Send private message
paulbiz
Guru
Guru


Joined: 01 Feb 2004
Posts: 506
Location: St. Louis, Missouri, USA

PostPosted: Sat Apr 30, 2005 6:23 am    Post subject: Reply with quote

It is a feature of glibc to detect corruption before it happens. It is a bug in the program that caused it. Invalid pointer, free() of memory that's already gone, etc.

You can control it on a per-run basis by setting the MALLOC_CHECK_ environment variable. If you explicitly set this variable it performs even more strict tests than normal.

0 -- Do not generate an error message, and do not kill the program
1 -- Generate an error message, but do not kill the program
2 -- Do not generate an error message, but kill the program
3 -- Generate an error message and kill the program

There is a "nomalloccheck" USE flag for glibc. Perhaps setting that will turn off this feature? I haven't tried it (glibc compile is so fast!)

Code:

[ Searching for packages matching glibc... ]
[ Colour Code : set unset ]
[ Legend        : Left column  (U) - USE flags from make.conf                     ]
[                  : Right column (I) - USE flags packages was installed with ]
[ Found these USE variables for sys-libs/glibc-2.3.5 ]
 U I
 + + nls           : <unknown>
 - - pic           : Build Position Independent Code. Needed for prelink or the hardened toolchain
 - - build         : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping.
 + + nptl          : Enable support for Native POSIX Threads Library, the new threading module (requires linux-2.6 or better usually)
 - - nptlonly      : Disables building the linuxthreads fallback in glibc ebuilds that support building both linuxthreads and nptl.
 - - erandom       : Enable erandom/frandom support in glibc for ssp
 - - hardened      : activate default security enhancements for toolchain (gcc, glibc, binutils)
 - - debug         : Tells configure and the makefiles to build for debugging. Effects vary across packages, but generally it will at least add -g to CFLAGS. Remember to set FEATURES=nostrip too
 + + userlocales   : build only the locales specified in /etc/locales.build
 - - nomalloccheck : default to not performing some sanity checks that prevent and detect data corruption. this removes the small overhead introduced by the check.
 - - multilib      : On 64bit systems, if you want to be able to compile 32bit and 64bit binaries
 - - debug         : Tells configure and the makefiles to build for debugging. Effects vary across packages, but generally it will at least add -g to CFLAGS. Remember to set FEATURES=nostrip too
Back to top
View user's profile Send private message
rhill
Retired Dev
Retired Dev


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Sat Apr 30, 2005 6:33 am    Post subject: Reply with quote

yep, the nomalloccheck USE flag disables these warnings. thanks for the info about MALLOC_CHECK_. i'm bookmarking this. :D
_________________
by design, by neglect
for a fact or just for effect
Back to top
View user's profile Send private message
paulbiz
Guru
Guru


Joined: 01 Feb 2004
Posts: 506
Location: St. Louis, Missouri, USA

PostPosted: Sat Apr 30, 2005 6:57 am    Post subject: Reply with quote

dirtyepic wrote:
yep, the nomalloccheck USE flag disables these warnings. thanks for the info about MALLOC_CHECK_. i'm bookmarking this. :D


"man malloc" and check the NOTES section at the bottom :)
Back to top
View user's profile Send private message
RaymondBeautrix
n00b
n00b


Joined: 03 Jul 2005
Posts: 32

PostPosted: Thu Jul 14, 2005 7:05 pm    Post subject: similar problem with firefox installer Reply with quote

I've tried firefox 1.0.4 installer, alpha 1 installer, alpha 2 installer, and latest trunk installer with no success. I tried recompiling glibc with the "nomalloccheck" use flag and nothing changed. I tried to run the firefox installer with setting MALLOC_CHECK_=1 to avoid program termination, but this also failed as one can see below.
Code:
BokuNoSekai firefox-installer # MALLOC_CHECK_=1 ./firefox-installer
malloc: using debugging hooks
malloc: using debugging hooks
malloc: using debugging hooks
malloc: using debugging hooks
*** glibc detected *** free(): invalid pointer: 0x081e5d48 ***
*** glibc detected *** free(): invalid pointer: 0x081e5d20 ***
*** glibc detected *** free(): invalid pointer: 0x081e5ac0 ***
*** glibc detected *** free(): invalid pointer: 0x081e5fd8 ***
*** glibc detected *** free(): invalid pointer: 0x081e6008 ***
*** glibc detected *** free(): invalid pointer: 0x081e6038 ***
*** glibc detected *** free(): invalid pointer: 0x081e6068 ***
*** glibc detected *** free(): invalid pointer: 0x081e6098 ***
*** glibc detected *** free(): invalid pointer: 0x081e60c8 ***
*** glibc detected *** free(): invalid pointer: 0x081e60f8 ***
*** glibc detected *** free(): invalid pointer: 0x081e6128 ***
*** glibc detected *** free(): invalid pointer: 0x081e5d98 ***
*** glibc detected *** free(): invalid pointer: 0x081e5dc0 ***
*** glibc detected *** free(): invalid pointer: 0x081e5de8 ***
*** glibc detected *** free(): invalid pointer: 0x081e5e10 ***
*** glibc detected *** free(): invalid pointer: 0x081e5e38 ***
*** glibc detected *** free(): invalid pointer: 0x081e5d70 ***
*** glibc detected *** free(): invalid pointer: 0x081e5e88 ***
*** glibc detected *** free(): invalid pointer: 0x081e5e60 ***
*** glibc detected *** free(): invalid pointer: 0x081e5ae0 ***
*** glibc detected *** malloc(): memory corruption (fast): 0x081e5af0 ***
./firefox-installer: line 72:  9084 Segmentation fault      "./${BINNAME}-bin" ${1+"$@"}   


I was told that this error might also relate to the cflags used for glibc. I use the following cflags.
Code:
CFLAGS="-O3 -march=pentium4 -mtune=pentium4 -fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -ftracer -pipe"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"


BobP recommended these cflags, even though may seem optimistic they're supposed to be very stable and reliable.

Even when I try to compile and install deer park alpha 1 or 2, when I try to run it nothing loads and firefox-bin shows up in my ProccessTable. I only have success when compiling 1.0.4, which is the version I'm trying to avoid because of its overall slow performance.

Any assistance would be greatly appreciated.

Thanks,
Ray
Back to top
View user's profile Send private message
frusware
n00b
n00b


Joined: 12 Jun 2004
Posts: 16

PostPosted: Fri Sep 02, 2005 6:17 pm    Post subject: Reply with quote

I'm stuck with a similar problem with ipac-ng. I'm not exactly shure when the problem occured as I've done several "emerge -uDvp system" without restarting the firewall. When I try to run fetchipac -S I get

Code:

a48056 ~ # fetchipac -S
*** glibc detected *** free(): invalid pointer: 0x08079428 ***
Aborted


I have already tried the MALLOC_CHECK_="1" environment variable, but it doesn't seem to help.

Code:

a48056 ~ # MALLOC_CHECK_="1" fetchipac -S
malloc: using debugging hooks
*** glibc detected *** free(): invalid pointer: 0x08079430 ***
*** glibc detected *** free(): invalid pointer: 0x08069378 ***
*** glibc detected *** free(): invalid pointer: 0x08094370 ***
*** glibc detected *** free(): invalid pointer: 0x08084160 ***
*** glibc detected *** free(): invalid pointer: 0x080a6320 ***
*** glibc detected *** free(): invalid pointer: 0x08095fc0 ***
*** glibc detected *** free(): invalid pointer: 0x080b8450 ***
*** glibc detected *** free(): invalid pointer: 0x080a7f98 ***
 calloc failed
: Cannot allocate memory


From what I understood this could be related to CFLAGS and timings, so I tried recompiling ipac-ng with several other CFLAG settings but I still get the same error. Below is the output of emerge info. Does anybody have any idea how to resolve this?

Any feedback is greatly appreciated.
Alex.

Code:

a48056 ~ # emerge info
Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.5-r1, 2.6.11-gentoo-r9 i686)
=================================================================
System uname: 2.6.11-gentoo-r9 i686 VIA Nehemiah
Gentoo Base System version 1.6.13
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
dev-lang/python:     2.2.3-r5, 2.3.5
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.4.19-r1, 2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=i686 -msse -mmmx -mfpmath=sse -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg ccache digest distcc distlocks fixpackages sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.easynet.nl/mirror/gentoo/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.easynet.nl/mirror/gentoo/ http://gentoo.inode.at/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X acpi alsa apache2 apm avi berkdb bitmap-fonts crypt cups curl dga directfb divx4linux dvd eds emboss encode esd fam fbcon flac foomaticdb fortran gd gdbm gif gnome gpm gstreamer gtk gtk2 guile imap imlib innodb java jpeg ldap libg++ libwww lirc mad mbox mikmod mmx motif mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oss pam pdflib perl png python quicktime readline samba sasl sdl slang spell sse ssl svga tcltk tcpd threads tiff transcode truetype truetype-fonts type1-fonts vorbis xml xml2 xmms xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Back to top
View user's profile Send private message
nxsty
Veteran
Veteran


Joined: 23 Jun 2004
Posts: 1556
Location: .se

PostPosted: Fri Sep 02, 2005 6:36 pm    Post subject: Reply with quote

dirtyepic wrote:
yep, the nomalloccheck USE flag disables these warnings. thanks for the info about MALLOC_CHECK_. i'm bookmarking this. :D


Nomalloccheck was removed from 2.3.5-r1 so now it's always on by default. :(
Back to top
View user's profile Send private message
frusware
n00b
n00b


Joined: 12 Jun 2004
Posts: 16

PostPosted: Fri Sep 02, 2005 7:07 pm    Post subject: Reply with quote

so there is no other way of suppressing the error message? Please don't tell me I have to emerge an older glibc.
Back to top
View user's profile Send private message
chtephan
Apprentice
Apprentice


Joined: 03 Feb 2004
Posts: 266
Location: Offenburg, Germany

PostPosted: Fri Sep 02, 2005 7:19 pm    Post subject: Reply with quote

Suppressing the malloc check would be working around the symptoms.

Fact is that one of programs (or libraries) you are using is buggy and writes to memory it shouldn't. You could always recompile your glibc with the nomalloccheck USE flag, but the real question is how you can figure out what is poking around in your memory.

Valgrind is a tool that does that. I'm using a glibc with malloc checks for a long time now and I have seen this message, but it always went away after the bug was fixed. So simply disabling the check would be the "duck and cover" strategy.

Is it only firefox-installer or do you see this with other programs too. Finding a common denominator would ease helping the broken package. If you are a bit familiar with debugging you could also try valgrind.
Back to top
View user's profile Send private message
frusware
n00b
n00b


Joined: 12 Jun 2004
Posts: 16

PostPosted: Fri Sep 02, 2005 7:36 pm    Post subject: Reply with quote

chtephan wrote:

Is it only firefox-installer or do you see this with other programs too. Finding a common denominator would ease helping the broken package. If you are a bit familiar with debugging you could also try valgrind.


I agree, I rather not suppress the error and I would like to resolve it correctly (I'm getting the error in ipac-ng, not in the firefox-installer). I'll see what valgrind can turn up, but since I'm a lazy ass java programmer who never has to deal with allocating memory, it could take a while before I track down the bug in ipac-ng.
Back to top
View user's profile Send private message
zoltak
n00b
n00b


Joined: 01 Mar 2005
Posts: 40

PostPosted: Wed Sep 14, 2005 11:51 pm    Post subject: ipac-ng problem resolved? Reply with quote

Has anyone managed to resolve this issue yet?
Back to top
View user's profile Send private message
frusware
n00b
n00b


Joined: 12 Jun 2004
Posts: 16

PostPosted: Thu Sep 15, 2005 5:35 am    Post subject: Reply with quote

As chtephan pointed out, it's not so much a problem with glibc or your compiler, but it has to do with the lib/app doing something it's not supposed to do. For the original poster jeffk a fix in mysql-administrator and smbc are required and for me, a fix in ipac-ng.
Zoltak: What app/lib is returning the warning?
Back to top
View user's profile Send private message
zoltak
n00b
n00b


Joined: 01 Mar 2005
Posts: 40

PostPosted: Thu Sep 15, 2005 5:46 am    Post subject: Reply with quote

I was using ipac-ng
Back to top
View user's profile Send private message
speak2000
n00b
n00b


Joined: 10 Dec 2005
Posts: 13

PostPosted: Mon May 08, 2006 5:29 am    Post subject: Reply with quote

I know this topic is really old, but I've noticed this problem with some C++ programs I've written that implement the destructor and copy constructor. The trouble resides there (at least in my case).
_________________
Code:
rm -r *

Oops.
Back to top
View user's profile Send private message
zoltak
n00b
n00b


Joined: 01 Mar 2005
Posts: 40

PostPosted: Mon May 08, 2006 6:11 am    Post subject: resolution Reply with quote

I upgraded IPTABLES and IPACC. This fixed the issue. There was a bug in IPACC when referencing something in the new version of IPTABLES. Maybe its a bug in your code?

edit: typo!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum