From owner-freebsd-hackers Tue Oct 22 12:25:37 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA7EF37B401 for ; Tue, 22 Oct 2002 12:25:35 -0700 (PDT) Received: from chiark.greenend.org.uk (chiark.greenend.org.uk [212.135.138.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id D419543E42 for ; Tue, 22 Oct 2002 12:25:34 -0700 (PDT) (envelope-from fanf@chiark.greenend.org.uk) Received: from fanf by chiark.greenend.org.uk with local (Exim 3.12 #1) id 1844ej-0006aK-00 (Debian); Tue, 22 Oct 2002 20:25:33 +0100 Date: Tue, 22 Oct 2002 20:25:33 +0100 From: Tony Finch To: Terry Lambert Cc: Tony Finch , hackers@freebsd.org Subject: Re: malloc Message-ID: <20021022202533.A29425@chiark.greenend.org.uk> References: <3DB5A07F.AA118FA6@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3DB5A07F.AA118FA6@mindspring.com>; from tlambert2@mindspring.com on Tue, Oct 22, 2002 at 12:01:19PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Oct 22, 2002 at 12:01:19PM -0700, Terry Lambert wrote: > Tony Finch wrote: > > Terry Lambert 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 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