Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Apr 2011 13:54:20 -0400
From:      Bob Hall <rjhjr0@gmail.com>
To:        "C. P. Ghost" <cpghost@cordula.ws>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Password theft from memory?
Message-ID:  <20110425175420.GA61811@stainmore>
In-Reply-To: <BANLkTinvvWhEy_A5ao=XWTpQOSTX0Vm2_A@mail.gmail.com>
References:  <BANLkTimJWAxW_4OmoeBQrvDDLjD-5Vr5hQ@mail.gmail.com> <BANLkTin_S%2BBRWu79AH16tPdgZd%2BUgZQAzQ@mail.gmail.com> <20110425151846.0a5359fd@gumby.homeunix.com> <20110425151536.GA61425@stainmore> <BANLkTinvvWhEy_A5ao=XWTpQOSTX0Vm2_A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 25, 2011 at 05:46:33PM +0200, C. P. Ghost wrote:
> On Mon, Apr 25, 2011 at 5:15 PM, Bob Hall <rjhjr0@gmail.com> wrote:
> > On Mon, Apr 25, 2011 at 03:18:46PM +0100, RW wrote:
> >> I don't believe the heap is allocated zeroed pages.  The kernel
> >> does allocate such pages to the BSS segment, but that's because it
> >> holds zeroed data such as C static variables.
> >
> > According to McKusick and Neville-Neil's book on FreeBSD, sbrk extends
> > the uninitialized data segment with zero-filled pages. Since malloc() is
> > an interface to sbrk, it does the same thing.
> 
> True, except that malloc(3) now uses both sbrk(2) and mmap(2) allocators,
> depending on the user-settable flags in /etc/malloc.conf, MALLOC_OPTIONS
> and the global variable _malloc_options. So you have to look into mmap(2)
> too.

Good point. From the man page:
"Any such extension beyond the end of the mapped object will be zero-filled."
and
"A successful mmap deletes any previous mapping in the allocated address range."



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