Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 1997 11:25:49 -0700
From:      "Jordan K. Hubbard" <jkh@time.cdrom.com>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Graham Wheeler <gram@cdsec.com>, hackers@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?) 
Message-ID:  <11017.874607149@time.cdrom.com>
In-Reply-To: Your message of "Thu, 18 Sep 1997 18:24:04 %2B0200." <10531.874599844@critter.freebsd.dk> 

next in thread | previous in thread | raw e-mail | index | archive | help
> This would indicate a bug of the class where memory is written to after
> being free()'ed, a kind of bug which phkmalloc makes no attempt to catch.

Man, I sure wish there was a copy of purify available for FreeBSD.
It's great at catching stuff like this! :(

Maybe you could hack free() to do an mprotect(addr, len, PROT_NONE) on
free'd pages, unprotecting them again as necessary when the malloc
routines themselves need to frob that memory.  Or, since we're just
testing, do it from an internally registered SIGBUS handler which
figures out the right thing to do. :-)

BTW, how *do* you get the faulting memory location from a SIGBUS
handler?  I was just playing around with this a bit and noted that it
wasn't immediately obvious how you'd get that info from the signal
handler.

					Jordan

P.S. I also noticed that processes which catch SIGBUS will dump
incomplete core files - only the first 8K is dumped.  Sounds like a
bug to me and I think we should either dump the whole thing or not
dump core at all rather than producing a truncated and rather useless
core file! :-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11017.874607149>