From owner-freebsd-current@FreeBSD.ORG Sun Apr 4 21:20:11 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C38516A4CE; Sun, 4 Apr 2004 21:20:11 -0700 (PDT) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8230D43D49; Sun, 4 Apr 2004 21:20:11 -0700 (PDT) (envelope-from alc@cs.rice.edu) Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id 1AFAA4AB8D; Sun, 4 Apr 2004 23:20:11 -0500 (CDT) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 00846-01-36; Sun, 4 Apr 2004 23:20:10 -0500 (CDT) Received: by cs.rice.edu (Postfix, from userid 19572) id BD2494AADD; Sun, 4 Apr 2004 23:20:10 -0500 (CDT) Date: Sun, 4 Apr 2004 23:20:10 -0500 From: Alan Cox To: Alexander Kabaev Message-ID: <20040405042010.GQ15786@cs.rice.edu> References: <20040402191254.GK26131@elvis.mu.org> <35917.1080933274@critter.freebsd.dk> <20040402195957.GN26131@elvis.mu.org> <20040404201251.GP15786@cs.rice.edu> <20040405041147.GA39962@kanpc.gte.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040405041147.GA39962@kanpc.gte.com> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavis-20030616-p7 at cs.rice.edu cc: alc@freebsd.org cc: kan@freebsd.org cc: Poul-Henning Kamp cc: Alfred Perlstein cc: current@freebsd.org Subject: Re: mmap breakage? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2004 04:20:11 -0000 On Mon, Apr 05, 2004 at 12:11:47AM -0400, Alexander Kabaev wrote: > On Sun, Apr 04, 2004 at 03:12:51PM -0500, Alan Cox wrote: > > Alfred, > > > > Please try the attached patch. This problems appears to be a > > consequence of vm/vm_mmap.c revision 1.180, where as part of a much > > needed code reorganization for locking the check for the /dev/zero > > special case got placed after the permissions check for the general > > case. This patch simply delays the permissions check for devices > > until you have the necessary lock to also check for /dev/zero. > > > > Since kan@ authored the reorganization, I'm cc:'ing him on this > > message for purposes of obtaining a review. (At least one comment > > should be updated to reflect my code changes.) > > > > Regards, > > Alan > > > > > Alan, Alfred, > > I had the following patch which is currently pending a review by > Peter Wemm. I meant to commit it on Friday, but ran out of time: > > > http://perforce.freebsd.org/chv.cgi?CH=50213 > I believe that there is a problem with this patch. Specifically, if maxprot is set to VM_PROT_ALL for devices in mmap(), then the security check in vm_mmap_vnode() has no effect. Please take a look at the entirety of the changes that I propose to mmap(). Regards, Alan