[uClibc]obscure malloc bug with debugging enabled ?

Glenn bug1 at optushome.com.au
Thu Jul 19 00:22:28 UTC 2001


A month or two ago there a brief discussion of a possible malloc bug in uclibc, i mentioned that i had on occasion experienced wierd behaviour... well, this is one of those times. The only simple explination i can think of is that uclibc isnt supposed to support debugging, but that should be a gcc thing i think.

Ive just checked in some new dpkg code into busybox CVS, it compiles and runs fine with glibc and dmalloc.

If i compile against uclibc with DODEBUG = true
Program received signal SIGSEGV, Segmentation fault.
0x08051e13 in malloc ()
(gdb) bt
#0  0x08051e13 in malloc ()
#1  0x08051181 in strdup ()
#2  0x0804e990 in xstrdup (s=0x80f5f50 "deinstall") at libbb/xfuncs.c:77
#3  0x08048214 in search_name_hashtable (key=0x80f5f50 "deinstall")
    at dpkg.c:176

I put some printf statements around the xstrdup line as such.

	printf("key value is [%s]\n", key);
	name_hashtable[probe_address] = xstrdup(key);
	printf("success\n");
	return(probe_address);
}

And i get the following output,

key value is [purge]
success
key value is [deinstall]
Segmentation fault

So the value of key should be legit.

The segfault only happens when i try and purge a package, "busybox dpkg -P test.deb" and i compiled it with uclibc and DODEBUG=true.

This is reproducable for me at the moment, so if it looks like an obscure bug and not something im overlooking then i can try and dig deeper.



Glenn





More information about the uClibc mailing list