Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jun 2005 13:12:11 +0200
From:      des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=)
To:        Mike Hunter <mhunter@ack.berkeley.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: unitialized memory is all zeros...why not garbage instead?
Message-ID:  <86vf4lb110.fsf@xps.des.no>
In-Reply-To: <20050610224058.GA11336@malcolm.berkeley.edu> (Mike Hunter's message of "Fri, 10 Jun 2005 15:40:58 -0700")
References:  <20050610224058.GA11336@malcolm.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Hunter <mhunter@ack.berkeley.edu> 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




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