Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Calloc bug.
@ 2002-07-08 16:12 alvin
  2002-07-08 16:31 ` Falk Hueffner
  0 siblings, 1 reply; 6+ messages in thread
From: alvin @ 2002-07-08 16:12 UTC (permalink / raw)
  To: axp-list

I believe there to be a bug in calloc. I have a couple of programs one
of which is a small disk space check program from netsaint. I have not
been yet able to create a small program that will recreate the error but
I keep getting a segfault in the chunck_alloc code.

I have run up dmalloc to see if there is a problem with the actuall use
of calloc and the problem then goes away. I have run dmalloc on another
offending program and the problem that I have there also seems to go
away.

Does anybody else know about this and possibly have a fix or am I going
to be spending a few days whakcing my head against the malloc code.

-- 
Alvin Starr                   ||   voice: (416)785-4051
Interlink Connectivity        ||   fax:   (416)785-3668
alvin@iplink.net              ||




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Calloc bug.
  2002-07-08 16:12 Calloc bug alvin
@ 2002-07-08 16:31 ` Falk Hueffner
  2002-07-08 20:04   ` alvin
  2002-07-08 20:41   ` alvin
  0 siblings, 2 replies; 6+ messages in thread
From: Falk Hueffner @ 2002-07-08 16:31 UTC (permalink / raw)
  To: axp-list

alvin <alvin@iplink.net> writes:

> I believe there to be a bug in calloc. I have a couple of programs one
> of which is a small disk space check program from netsaint. I have not
> been yet able to create a small program that will recreate the error but
> I keep getting a segfault in the chunck_alloc code.
> 
> I have run up dmalloc to see if there is a problem with the actuall use
> of calloc and the problem then goes away. I have run dmalloc on another
> offending program and the problem that I have there also seems to go
> away.
> 
> Does anybody else know about this and possibly have a fix or am I going
> to be spending a few days whakcing my head against the malloc code.

It is is unlikely that this is a bug in malloc; malloc is very mature
code. More likely, it is a bug in your code that destroys malloc's
internal structures, the classical example being array overruns. We
cannot decide that though without a test case.

If you have an i386 with Linux, you might want to try valgrind, a
memory debugger which can catch such errors.

-- 
	Falk




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Calloc bug.
  2002-07-08 16:31 ` Falk Hueffner
@ 2002-07-08 20:04   ` alvin
  2002-07-08 20:41   ` alvin
  1 sibling, 0 replies; 6+ messages in thread
From: alvin @ 2002-07-08 20:04 UTC (permalink / raw)
  To: axp-list

Falk Hueffner wrote:
> 
> alvin <alvin@iplink.net> writes:
> 
> > I believe there to be a bug in calloc. I have a couple of programs one
> > of which is a small disk space check program from netsaint. I have not
> > been yet able to create a small program that will recreate the error but
> > I keep getting a segfault in the chunck_alloc code.
> >
> > I have run up dmalloc to see if there is a problem with the actuall use
> > of calloc and the problem then goes away. I have run dmalloc on another
> > offending program and the problem that I have there also seems to go
> > away.
> >
> > Does anybody else know about this and possibly have a fix or am I going
> > to be spending a few days whakcing my head against the malloc code.
> 
> It is is unlikely that this is a bug in malloc; malloc is very mature
> code. More likely, it is a bug in your code that destroys malloc's
> internal structures, the classical example being array overruns. We
> cannot decide that though without a test case.
> 
> If you have an i386 with Linux, you might want to try valgrind, a
> memory debugger which can catch such errors.

Now I am willing to believe that there is a bug here but using gdb and
dmalloc either strcpy is failing or strstr is modifying the string it is
looking at.



-- 
Alvin Starr                   ||   voice: (416)785-4051
Interlink Connectivity        ||   fax:   (416)785-3668
alvin@iplink.net              ||




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Calloc bug.
  2002-07-08 16:31 ` Falk Hueffner
  2002-07-08 20:04   ` alvin
@ 2002-07-08 20:41   ` alvin
  2002-07-08 21:06     ` Uncle George
  1 sibling, 1 reply; 6+ messages in thread
From: alvin @ 2002-07-08 20:41 UTC (permalink / raw)
  To: axp-list

Falk Hueffner wrote:
> 
> alvin <alvin@iplink.net> writes:
> 
> > I believe there to be a bug in calloc. I have a couple of programs one
> > of which is a small disk space check program from netsaint. I have not
> > been yet able to create a small program that will recreate the error but
> > I keep getting a segfault in the chunck_alloc code.
> >
> > I have run up dmalloc to see if there is a problem with the actuall use
> > of calloc and the problem then goes away. I have run dmalloc on another
> > offending program and the problem that I have there also seems to go
> > away.
> >
> > Does anybody else know about this and possibly have a fix or am I going
> > to be spending a few days whakcing my head against the malloc code.
> 
> It is is unlikely that this is a bug in malloc; malloc is very mature
> code. More likely, it is a bug in your code that destroys malloc's
> internal structures, the classical example being array overruns. We
> cannot decide that though without a test case.
> 
> If you have an i386 with Linux, you might want to try valgrind, a
> memory debugger which can catch such errors.

Damn. The one problem that I could track down turned out to be a
programming bug after all. I assume that my second problem that I cannot
easly debug will also turn out to be a programming bug.

Is there any "sloppy" malloc out there that will leave room at the end
of a block for those who have the +/-1 problem with programming loops?



-- 
Alvin Starr                   ||   voice: (416)785-4051
Interlink Connectivity        ||   fax:   (416)785-3668
alvin@iplink.net              ||




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Calloc bug.
  2002-07-08 20:41   ` alvin
@ 2002-07-08 21:06     ` Uncle George
  2002-07-09  1:27       ` Calloc bug(not) Alvin Starr
  0 siblings, 1 reply; 6+ messages in thread
From: Uncle George @ 2002-07-08 21:06 UTC (permalink / raw)
  To: axp-list

Maybe "Electricfence" is for you. It will crash your pgm if you try to
write out of the 'malloc`d' area ( as the boundary is write protected
from trespass.) Its not always convenient, as each little malloced area
eats up (at least a ) shared memory segment

alvin wrote:
> 
> Is there any "sloppy" malloc out there that will leave room at the end
> of a block for those who have the +/-1 problem with programming loops?
>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Calloc bug(not).
  2002-07-08 21:06     ` Uncle George
@ 2002-07-09  1:27       ` Alvin Starr
  0 siblings, 0 replies; 6+ messages in thread
From: Alvin Starr @ 2002-07-09  1:27 UTC (permalink / raw)
  To: axp-list

Uncle George wrote:
> Maybe "Electricfence" is for you. It will crash your pgm if you try to
> write out of the 'malloc`d' area ( as the boundary is write protected
> from trespass.) Its not always convenient, as each little malloced area
> eats up (at least a ) shared memory segment
> 
> alvin wrote:
> 
>>Is there any "sloppy" malloc out there that will leave room at the end
>>of a block for those who have the +/-1 problem with programming loops?
>>

I tracked down the bug in netsaint to a silly bug(malloc'ing char sized 
itmes in stead of pointer sized items).

dmalloc did catch the bug when all the checking was turned on. dmalloc 
did however let the bug go past when there was no debugging turned on. I 
will find out tonight if this fixes the problem I am seeing with 
Arkeia(this is the bakup client I am using and it worked with RH6.2 but 
not RH7.x). I think dmalloc will fit my requirement as a sloppy malloc 
when the debug tests are turned off.





-- 
Alvin Starr                   ||   voice: (416)585-9971
Interlink Connectivity        ||   fax:   (416)585-9974
alvin@iplink.net              ||




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-07-09  1:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-08 16:12 Calloc bug alvin
2002-07-08 16:31 ` Falk Hueffner
2002-07-08 20:04   ` alvin
2002-07-08 20:41   ` alvin
2002-07-08 21:06     ` Uncle George
2002-07-09  1:27       ` Calloc bug(not) Alvin Starr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox