unitialized memory is all zeros...why not garbage instead?
Dag-Erling Smørgrav
des at des.no
Sat Jun 11 11:12:22 GMT 2005
Mike Hunter <mhunter at 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
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-hackers
mailing list