On Thu, Apr 08, 1999 at 04:51:26PM +0200, Przemek Borys wrote:
> EHLO!
> 
> What can cause a segmentation fault? Things, which I'm aware of, are 
> checked, and they are
> -incorrect malloc/realloc/free operations
> -bad hardware
> -a bug in libc
> 
> To make clear of what I'm talking about:
> I wrote a program (info viewer -- pinfo), and in two functions I get 
> segmentation faults. I've checked it on few machines, running 
> different operating systems, and the result was always the same.
> I also run the program compiled with -lefence, and after that I also 
> tried with -lccmalloc. The result was that the segmentation faults 
> didn't occur at all.

I don't know how ccmalloc works, but Electric Fence uses the 
processor hardware to detect illegal memory accesses.  By default,
its memory allocations are page aligned, so, small overruns are
not detected.  Try setting EF_ALIGNMENT=0 in the shell and see
if you can detect the clobber.  EF_PROTECT_BELOW=1 will catch
buffer underruns.

> I've also created wrappers for malloc/realloc/free, which logged what 
> they werre doing. And nothing. The program sigsegv'ed on realloc() when 
> reallocating block of (re)allocated previously memory (of certain size).
> Gdb said that all those faults came from libc_free...

Are you compiling with "-ggdb"?

Kurt
-- 
lisp, v.:
        To call a spade a thpade.

Reply via email to