From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 11 11:12:22 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 887FB16A41C for ; Sat, 11 Jun 2005 11:12:22 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B61C43D48 for ; Sat, 11 Jun 2005 11:12:21 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 2798E60F3; Sat, 11 Jun 2005 13:12:12 +0200 (CEST) Received: from xps.des.no (des.no [80.203.228.37]) by tim.des.no (Postfix) with ESMTP id 091FD60F2; Sat, 11 Jun 2005 13:12:12 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id E30C733C3B; Sat, 11 Jun 2005 13:12:11 +0200 (CEST) To: Mike Hunter References: <20050610224058.GA11336@malcolm.berkeley.edu> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Sat, 11 Jun 2005 13:12:11 +0200 In-Reply-To: <20050610224058.GA11336@malcolm.berkeley.edu> (Mike Hunter's message of "Fri, 10 Jun 2005 15:40:58 -0700") Message-ID: <86vf4lb110.fsf@xps.des.no> User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Learn: ham X-Spam-Score: -5.1/5.0 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on tim.des.no Cc: freebsd-hackers@freebsd.org Subject: Re: unitialized memory is all zeros...why not garbage instead? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2005 11:12:22 -0000 Mike Hunter writes: > I have a feeling that I'm missing something really obvious, but I'm having > trouble understanding why the following program: > [...] > Never prints anything but "0"'s. Because the kernel always hands processes pre-zeroed pages. > I ran less up to my hw.physmem by feeding it /dev/random and watching > top, and then ran the program, so I "know" there was tons of non-zero > bits in memory. If your program had been able to see leftovers from less in its own address space, we'd have a huge security hole on our hands. > I'm curious because I am worried about information leaks between processes > on the same machine...did somebody decide to solve this problem while I > wasn't paying attention? :) It's always been this way. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no