From owner-freebsd-questions@FreeBSD.ORG Wed Apr 27 23:10:20 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80123106566B for ; Wed, 27 Apr 2011 23:10:20 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 086778FC15 for ; Wed, 27 Apr 2011 23:10:19 +0000 (UTC) Received: by wwc33 with SMTP id 33so2264760wwc.31 for ; Wed, 27 Apr 2011 16:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding; bh=xx7XI4sCWn4iUu6QLXmVscZG4XHJK1Eb0dct6lzR+fI=; b=AAF9tiYZMZRkTAFDcZ5OGNInfc5JIsUz7H9mheOBkObEfJBGt/CoV1CP8+cwaMswMv iL9k4HACEafCJIMyx0020WG+Qyq/lGj2MdkgrpKiX256+I62y0ZRrA/qnXriYGlhDnBs BK5B9Mfw/RCJHlYK6xy6xMlqGYmZ2QOxqQpk4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=b+Rjoz+z2fZvB1xQUDLUmgI14CMuv32RkJ6ZZaD7CzbpgvNbwt0Pe9JeKumiw/w0zM VX5PtSFRCOC490By0bI0TyitywdPVWp75T5XDS8/hZPPjuBMUVOxJ+zZEcFSJ53umdvq x6mmryOGAzDpjrwFk1pKCj4IDCBTpG0wYWKqQ= Received: by 10.216.136.89 with SMTP id v67mr2696103wei.47.1303945818663; Wed, 27 Apr 2011 16:10:18 -0700 (PDT) Received: from gumby.homeunix.com (87-194-105-247.bethere.co.uk [87.194.105.247]) by mx.google.com with ESMTPS id g46sm598414wes.40.2011.04.27.16.10.13 (version=SSLv3 cipher=OTHER); Wed, 27 Apr 2011 16:10:17 -0700 (PDT) Date: Thu, 28 Apr 2011 00:10:10 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20110428001010.13a76d07@gumby.homeunix.com> In-Reply-To: <20110427095420.GA41208@kongemord.krig.net> References: <20110425151846.0a5359fd@gumby.homeunix.com> <20110425151536.GA61425@stainmore> <20110425175420.GA61811@stainmore> <20110425232908.4104e026@gumby.homeunix.com> <20110426025614.GA62745@stainmore> <20110426104151.596bcc19@gumby.homeunix.com> <20110427014554.1e4c5281@gumby.homeunix.com> <20110427095420.GA41208@kongemord.krig.net> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.1; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: Password theft from memory? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2011 23:10:20 -0000 On Wed, 27 Apr 2011 06:14:02 -0400 Bob Hall 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.