[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Deactivate MALLOC_CHECK_ on x86_64
From: Andreas Hartmetz <ahartmetz () gmail ! com>
Date: 2009-11-16 23:05:29
Message-ID: 200911170005.29743.ahartmetz () gmail ! com
[Download RAW message or body]
On Monday 16 November 2009 11:22:09 Stephan Kulow wrote:
> Am Freitag 13 November 2009 schrieb Raphael Kubo da Costa:
> > On Friday 13 November 2009 13:11:57 Alex Fiestas wrote:
> > > Hi
> > > Seems that MALLOC_CHECK_ feature of glibc is kind of broken in x86_64,
> > > giving false positives. In release mode this has no effect to the
> > > user, just when you're running KDE in development mode, MALLOC_CHECK_
> > > will be set at 2, which means that malloc will abort the application
> > > when one of that false given errors happen.
> > >
> > > So I suggest to deactivate MALLOC_CHECK_ on 64 bits systems, at least
> > > until it gets fixed.
> > >
> > > Some applications that usually crash on my system are:
> > > - digikam (I'm in digikam sprint right now and I've asked gilles and he
> > > agrees)
> > > - kdevelop (I'm with apol here and he's concerned about this issue
> > > too).
> > >
> > > Everybody agrees with that?
> > >
> > > *http://techbase.kde.org/Development/malloc_check
> >
> > Are you sure about it being broken only in x86_64? I'm running x86 and
> > always get false positives too. I don't remember mpyne or maelcum
> > perceiving it as a 64-bit-only problem either.
>
> It's broken in glibc 2.10, not architecture specific. openSUSE runs the
> whole system during the beta phase on MALLOC_CHECK_=3 and we had a lot of
> fun with this ;(
>
> But disabling MALLOC_CHECK_ on KDE makes little sense as KDE has almost no
> way to find out if the system is affected or not - openSUSE's glibc 2.10 is
> not. Perhaps you can apply openSUSE's patch to your glibc?
>
> Greetings, Stephan
>
Downloading the package and extracting the relevant patch took me a while, so
I've attached the patch here.
Cheers,
Andreas
["glibc-2.10-mcheck-free-race.diff" (text/x-patch)]
2009-06-15 Petr Baudis <pasky@suse.cz>
* malloc/hooks.c (free_check): Do not invoke mem2chunk_check()
without main_arena mutex held.
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 622a815..47d3c85 100644
--- malloc/hooks.c
+++ malloc/hooks.c
@@ -276,25 +276,33 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
mchunkptr p;
if(!mem) return;
+#ifndef ATOMIC_FASTBINS
+ (void)mutex_lock(&main_arena.mutex);
+#endif
p = mem2chunk_check(mem, NULL);
if(!p) {
+#ifndef ATOMIC_FASTBINS
+ (void)mutex_unlock(&main_arena.mutex);
+#endif
malloc_printerr(check_action, "free(): invalid pointer", mem);
return;
}
#if HAVE_MMAP
if (chunk_is_mmapped(p)) {
munmap_chunk(p);
- return;
- }
+ } else
#endif
+ {
#if 0 /* Erase freed memory. */
- memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
+ memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
#endif
#ifdef ATOMIC_FASTBINS
- _int_free(&main_arena, p, 0);
+ _int_free(&main_arena, p, 0);
#else
- (void)mutex_lock(&main_arena.mutex);
- _int_free(&main_arena, p);
+ _int_free(&main_arena, p);
+#endif
+ }
+#ifndef ATOMIC_FASTBINS
(void)mutex_unlock(&main_arena.mutex);
#endif
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic