From owner-freebsd-hackers Mon Feb 15 17:53:16 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA11042 for freebsd-hackers-outgoing; Mon, 15 Feb 1999 17:53:16 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from iquest3.iquest.net (iquest3.iquest.net [209.43.20.203]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id RAA11036 for ; Mon, 15 Feb 1999 17:53:15 -0800 (PST) (envelope-from toor@y.dyson.net) Received: (qmail 13768 invoked from network); 16 Feb 1999 01:53:12 -0000 Received: from dyson.iquest.net (HELO y.dyson.net) (198.70.144.127) by iquest3.iquest.net with SMTP; 16 Feb 1999 01:53:12 -0000 Received: (from root@localhost) by y.dyson.net (8.9.1/8.9.1) id UAA24408; Mon, 15 Feb 1999 20:53:03 -0500 (EST) Message-Id: <199902160153.UAA24408@y.dyson.net> Subject: Re: vm_page_zero_fill In-Reply-To: <199902152350.RAA04318@home.dragondata.com> from Kevin Day at "Feb 15, 99 05:50:48 pm" To: toasty@home.dragondata.com (Kevin Day) Date: Mon, 15 Feb 1999 20:53:03 -0500 (EST) Cc: hackers@FreeBSD.ORG From: "John S. Dyson" Reply-To: dyson@iquest.net X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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