From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 12 14:27:28 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8F7737B401 for ; Sat, 12 Jul 2003 14:27:28 -0700 (PDT) Received: from milla.ask33.net (milla.ask33.net [217.197.166.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id D211543F85 for ; Sat, 12 Jul 2003 14:27:27 -0700 (PDT) (envelope-from nick@milla.ask33.net) Received: by milla.ask33.net (Postfix, from userid 1001) id 8E99F3ABB51; Sat, 12 Jul 2003 23:32:49 +0200 (CEST) Date: Sat, 12 Jul 2003 23:32:49 +0200 From: Pawel Jakub Dawidek To: "Alan L. Cox" Message-ID: <20030712213249.GJ4973@garage.freebsd.pl> References: <20030712202216.GG4973@garage.freebsd.pl> <3F10762E.D17A7307@imimic.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="y06s9PvpQ1Ch5mdL" Content-Disposition: inline In-Reply-To: <3F10762E.D17A7307@imimic.com> X-PGP-Key-URL: http://garage.freebsd.pl/jules.asc X-OS: FreeBSD 4.8-RELEASE i386 X-URL: http://garage.freebsd.pl User-Agent: Mutt/1.5.1i cc: freebsd-hackers@freebsd.org Subject: Re: Bug in VM pages protection handling. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jul 2003 21:27:29 -0000 --y06s9PvpQ1Ch5mdL Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 12, 2003 at 03:57:18PM -0500, Alan L. Cox wrote: +> > I've just send PR for this: +> >=20 +> > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D54418 +> >=20 +> > I'll be greatful if somebody could review, commit and MFC it +> > as soon as possible. I need to hold CerbNG next release until +> > it will be fixed. +> >=20 +>=20 +> As I've said in private e-mail, this is not a bug. You're really asking +> for a change in "specification". Reductions in max_protection have had +> permanent effect since the late 1980's. You've also asked my in private mail why I need this, I'll answer here. I need this to protect syscall arguments that I'm checking in CerbNG. If I need to check an argument I've to be sure that kernel will check exactly that same argument (here is ugly race). So what I do is memory allocaton in process' vmspace, copy argument there, mark newly allocated pages as read-only and call original syscall with new pointer(s). Those pages are freed after that and everything will be correct, but somebody has reported me about 'bus error'. I've track this problem for two days. It occurs for majordomo, when perl is trying to execute something, nevermind. Pages are marked as read-only for child process, but parent process is killed with SIGBUS signal. I don't mees with this parent process at all, but it looks they're sharing some memory or some pages/map is mirrored (copy-on-write mechanism?) with VM_PROT_READ protection. Of course I could rewrite vm_map_protect() function locally and use my version (I hate such hacks, but if there is no other way...), but for me it is strange. Is there something that depends on this or proposed patch breaks anything? Why specification says that? Ok, I don't want to provoke specification breakage, I was just thinking that this was a bug, so PR could be closed, sorry. PS1. Maybe you (or anyone) have better solution for syscall arguments protecting to avoid this race? PS2. Where could I find FreeBSD's VM specification? Or maybe I should look for posix VM spcification? --=20 Pawel Jakub Dawidek pawel@dawidek.net UNIX Systems Programmer/Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am! http://cerber.sourceforge.net --y06s9PvpQ1Ch5mdL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iQCVAwUBPxB+gT/PhmMH/Mf1AQFNEgP/fVhNelTLT474259wGgBhL7QaPjGhqQJ2 MasfdiVcZOTH0AUzSe8yEEuEFxQRgTcYxZ7b0Tvnlu2XVXUOHNHDOQ1ct5r8zrLQ ETcTjyGmoThO/USV8UqVjUxtLa/y5afwz1TLPCKTig8D5U//dunqeCSRS8/sAI9K ZtAhYYQlTlk= =g1uZ -----END PGP SIGNATURE----- --y06s9PvpQ1Ch5mdL--