Date: Mon, 15 Feb 1999 20:53:03 -0500 (EST) From: "John S. Dyson" <dyson@iquest.net> To: toasty@home.dragondata.com (Kevin Day) Cc: hackers@FreeBSD.ORG Subject: Re: vm_page_zero_fill Message-ID: <199902160153.UAA24408@y.dyson.net> In-Reply-To: <199902152350.RAA04318@home.dragondata.com> from Kevin Day at "Feb 15, 99 05:50:48 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Kevin Day said: > > I'm currently playing with FreeBSD in an embedded system, where security is > of no concern. The system I'm using has relatively poor memory bandwidth, so > I was looking for places to optimize. I know how the vm system zeros pages > before giving them to me, which isn't really necessary. (I'm not sure about > other software on the fbsd distribution, but all code I've written expects > malloc(), new, etc to have garbage in them, not be zeroed) > Userland won't like non-zeroed memory regions. Some of the kernel might balk at it also. > > I don't pretend to understand the VM system, but as a quick test, I made > vm_page_zero_fill a NOP. (This seemed like where this was getting done). > That would be problematical. > > The system ran, but inetd, sed and ld kept crashing on sig 11's or 6's. > Everything else I ran seemed ok though. While I know ther are better ways of > doing this, am I going to be fighting a huge battle of making the kernel, as > well as userland tools capable of dealing with nonzero'ed memory, or am I > seeing a completely different problem? > 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. > > If this is a really stupid question, feel free to flame. I'm sure it's a > case of ignorance on my part. :) > What you ask for might produce unexpected behavior in existant code, but isn't (IMO) a out-of-the-question request. I would suggest that you produce a special binary type of some kind, and allow the kernel to give you pages that haven't been zeroed. You would also turn off the background prezero code. You could then run both converted and non-converted programs. The kernel could also set the vm behavior to trap with a special fault if a process reads a memory location without it being intialized by either a write, a pagein from disk or inheritance from a parent process. -- John | Never try to teach a pig to sing, dyson@iquest.net | it makes one look stupid jdyson@nc.com | and it irritates the pig. 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?199902160153.UAA24408>