Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 06:14:02 -0400
From:      Bob Hall <rjhjr0@gmail.com>
To:        RW <rwmaillists@googlemail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Password theft from memory?
Message-ID:  <20110427095420.GA41208@kongemord.krig.net>
In-Reply-To: <20110427014554.1e4c5281@gumby.homeunix.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 26, 2011 at 11:41 AM, RW <rwmaillists@googlemail.com>
wrote:
>> The above quote states that the memory not occupied by the remapped
>> object is zero filled. Which is to say that memory allocated by
>> mmap() is either filled with new data or filled with zeros.
>
> In context it says:
>
>     "If len is not a multiple of the page-size, the mapped region
> may extend past the specified range.  Any such extension beyond the
>     end of the mapped object will be zero-filled."
>
> To me the most straightforward reading of that is that it's
> referring to non-aligned address ranges.
>
> Your interpretation may well be the intended one, but where would
> that leave the anonymous mappings used by malloc? Are we to think
> of them as extensions beyond a non-existent mapped object, and thus
> infer that they are zero-filled? It's a bit of a stretch from
> what's written.

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. 

This answers the original poster's question. If you've gone on to a
different issue then I apologize for not following you.



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