Date: Thu, 28 Apr 2011 00:10:10 +0100 From: RW <rwmaillists@googlemail.com> To: freebsd-questions@freebsd.org Subject: Re: Password theft from memory? Message-ID: <20110428001010.13a76d07@gumby.homeunix.com> In-Reply-To: <20110427095420.GA41208@kongemord.krig.net> References: <BANLkTin_S%2BBRWu79AH16tPdgZd%2BUgZQAzQ@mail.gmail.com> <20110425151846.0a5359fd@gumby.homeunix.com> <20110425151536.GA61425@stainmore> <BANLkTinvvWhEy_A5ao=XWTpQOSTX0Vm2_A@mail.gmail.com> <20110425175420.GA61811@stainmore> <20110425232908.4104e026@gumby.homeunix.com> <20110426025614.GA62745@stainmore> <20110426104151.596bcc19@gumby.homeunix.com> <BANLkTikQzhmyXkCeSzzG-o%2Bz0L3ohNt2YQ@mail.gmail.com> <20110427014554.1e4c5281@gumby.homeunix.com> <20110427095420.GA41208@kongemord.krig.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 27 Apr 2011 06:14:02 -0400
Bob Hall <rjhjr0@gmail.com> wrote:
> malloc() uses either sbrk or mmap to extend the heap. As far as I
> know, sbrk extends the heap with zero filled memory. According to the
> man page, mmap extends it either with remapped data, or with remapped
> data plus additional zero filled memory.
The man page doesn't mean what you think it means. It's a lot clearer
here:
http://pubs.opengroup.org/onlinepubs/007908799/xsh/mmap.html
"The system always zero-fills any partial page at the end of an
object. Further, the system never writes out any modified portions of
the last page of an object that are beyond its end. References
within the address range starting at pa and continuing for len bytes
to whole pages following the end of an object result in delivery of
a SIGBUS signal."
I'm not saying that anonymous mappings used by malloc aren't
zero-filled, just that it's not mentioned anywhere in the mmap man
page. I think it's just taken as read.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110428001010.13a76d07>
