Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2002 20:25:33 +0100
From:      Tony Finch <dot@dotat.at>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Tony Finch <dot@dotat.at>, hackers@freebsd.org
Subject:   Re: malloc
Message-ID:  <20021022202533.A29425@chiark.greenend.org.uk>
In-Reply-To: <3DB5A07F.AA118FA6@mindspring.com>; from tlambert2@mindspring.com on Tue, Oct 22, 2002 at 12:01:19PM -0700
References:  <E183u5Y-0003Yc-00@cse.cs.huji.ac.il> <E183xYK-0003aB-00@chiark.greenend.org.uk> <3DB5A07F.AA118FA6@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 22, 2002 at 12:01:19PM -0700, Terry Lambert wrote:
> Tony Finch wrote:
> > Terry Lambert <tlambert2@mindspring.com> wrote:
> > >The FreeBSD malloc guarantees that the pages are zeroed before being
> > >obtained from the system; this is probably the majority of the cost.
> > >It is a security measure, so that you do not leak data from one process
> > >to another through anonymous pages.
> > >
> > >The Linux malloc does not.
> > 
> > Utter bollocks. FreeBSD malloc can be configured to re-initialize memory
> > on every allocation, but this is designed to assist with buggy programs,
> > it is *not* a security measure. Memory obtained from the kernel on *all*
> > unices (including Linux) is zeroed; that is when security matters, not
> > in malloc. This will not affect the relative performance of phk and gnu
> > malloc.
> 
> *before being obtained from the system*.

Linux does that too, and you appeared to be saying that it doesn't which
is clearly wrong for the security reasons that you stated. It therefore
won't affect the relative performance.

> And I didn't say that.  I only said that the pages were zeroed *before
> being obtained from the system*.  This is what you would expect, with
> anonymous memory accessed off /dev/zero.

PHK malloc uses MAP_ANON on FreeBSD, not /dev/zero -- it uses the
latter only if compiled for Solaris.

Tony.
-- 
f.a.n.finch <dot@dotat.at> http://dotat.at/
FAIR ISLE: NORTHEAST BACKING NORTH 5 TO 7 INCREASING 7 TO SEVERE GALE 9,
OCCASIONALLY STORM 10 IN EAST. RAIN. MODERATE OR POOR.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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