Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 1999 22:39:17 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        dyson@iquest.net
Cc:        toasty@home.dragondata.com, hackers@FreeBSD.ORG
Subject:   Re: vm_page_zero_fill
Message-ID:  <199902162239.PAA07971@usr08.primenet.com>
In-Reply-To: <199902160153.UAA24408@y.dyson.net> from "John S. Dyson" at Feb 15, 99 08:53:03 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Userland won't like non-zeroed memory regions.  Some of the kernel might
> balk at it also.

I can understand the kernel assumptions... but user space????


> Alot of code might do something like:
> 
> int foo;
> 
> main()
> {
> 	foo += 1;
> }
> 
> and expect foo to be equal to 1 instead of being indeterminant.  If you turn
> vm_page_zero_fill off entirely, then this will be a problem.  The kernel code
> does things like this also, unfortunately.

BSS is supposed to be zeroed on startup.  I can see you *maybe* getting
the pages for it out of /dev/zero, but /dev/zero would *have* to be
special cased, for semantic, not security, reasons.  If it's not using
/dev/zero, then it should be done in crt0.o, not rely on the kernel to
do the job.

For the user code assumptions in other places, well, the FreeBSD
crt0.o uses sufficiently more stack than the Linux equivalent that
Linux programs can use stack variables as if they are zeroed (e.g.
the standard Linux programmer trick of an uninitializaed sockaddr_in
causes problems on FreeBSD).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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