Problems with dmalloc5

Martin Pool mbp at canonical.com
Wed Mar 28 00:24:51 UTC 2012


On Wed, Mar 28, 2012 at 8:20 AM, Dale Amon <amon at vnl.com> wrote:
> Okay, I think I've put the ball firmly in your
> court.
>
> Here is the test program:
>
> -----------------------------------------------------
> #include        <objc/Object.h>
> #include        <dmalloc.h>
>
> main (int argc, char *argv[]) {
>  size_t len;
>  char *fname;
>  char *rootname = "TESTFILE";
>
>  len   = strlen (rootname) + 1;
>  fname = (char *) calloc (len,1);
>
>  printf ("rootname=%s len=%d\n", rootname,len);
> }
> -----------------------------------------------------
>
> Compiled with this line:
>
>        gcc -o tst tst.m -ldmalloc
>
> and it gives this result:
>
> $ ./tst
> rootname=TESTFILE len=9
> Segmentation fault
>
> -----------------------------------------------------
>
> System is a Thinkpad T40 with up to date Oneiric.

Well, I suggest you file a bug against dmalloc on launchpad.net (or
quote the number if you already have.)  That is generally better than
just posting them here.

My next step would be to run this under gdb and find out exactly where
it is crashing.

Tangentially, these days I would tend to use Valgrind rather than
dmalloc.  But, of course, if it's in Ubuntu it ought to work, and I
suppose you have existing trees that use it.

I had a brief look,and it turns out you can simplify this program
quite a lot and it still crashes.  To start with I changed to plain C,
and then just

#include        <dmalloc.h>

int main (int argc, char *argv[]) {
	malloc(1);
	return 0;
}

and gdb shows this fails with dmalloc going in to an infinite loop
trying to print something:

#5  0x00007ffff7af11fa in ?? () from /usr/lib/libdmalloc.so.5
#6  0x00007ffff7af1a72 in dmalloc_free () from /usr/lib/libdmalloc.so.5
#7  0x00007ffff7771ba4 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00007ffff7831580 in __vsnprintf_chk () from
/lib/x86_64-linux-gnu/libc.so.6
#9  0x00007ffff7aebf7e in loc_vsnprintf () from /usr/lib/libdmalloc.so.5
#10 0x00007ffff7aec022 in loc_snprintf () from /usr/lib/libdmalloc.so.5
#11 0x00007ffff7af0c48 in _dmalloc_die () from /usr/lib/libdmalloc.so.5
#12 0x00007ffff7af11fa in ?? () from /usr/lib/libdmalloc.so.5
#13 0x00007ffff7af1a72 in dmalloc_free () from /usr/lib/libdmalloc.so.5
#14 0x00007ffff7771ba4 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6
#15 0x00007ffff7831580 in __vsnprintf_chk () from
/lib/x86_64-linux-gnu/libc.so.6
#16 0x00007ffff7aebf7e in loc_vsnprintf () from /usr/lib/libdmalloc.so.5
#17 0x00007ffff7aec022 in loc_snprintf () from /usr/lib/libdmalloc.so.5

I guess dmalloc is out of date with something that changed in libc.

-- 
Martin



More information about the Ubuntu-devel-discuss mailing list