From owner-freebsd-arch@FreeBSD.ORG Mon Mar 28 22:39:00 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA50E16A4CE; Mon, 28 Mar 2005 22:39:00 +0000 (GMT) Received: from lakermmtao08.cox.net (lakermmtao08.cox.net [68.230.240.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1B3443D3F; Mon, 28 Mar 2005 22:38:59 +0000 (GMT) (envelope-from mezz7@cox.net) Received: from mezz.mezzweb.com ([68.103.32.140]) by lakermmtao08.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050328223857.IKQB18351.lakermmtao08.cox.net@mezz.mezzweb.com>; Mon, 28 Mar 2005 17:38:57 -0500 Date: Mon, 28 Mar 2005 16:39:55 -0600 To: "John Baldwin" References: <200503281734.45926.jhb@FreeBSD.org> From: "Jeremy Messenger" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <200503281734.45926.jhb@FreeBSD.org> User-Agent: Opera M2/7.54 (Linux, build 955) cc: arch@freebsd.org Subject: Re: Fixing DRM after phk's drive-by axeing X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2005 22:39:01 -0000 On Mon, 28 Mar 2005 17:34:45 -0500, John Baldwin wrote: > I have a commit-ready version of the vm_mmap() changes I made to get drm > to > work happily with the newer, cleaner cdev stuff that phk has been > working on. > Basically, I've changed vm_mmap() so that it can accept either a vnode > or a > cdev as its handle argument rather than just vnodes. For the cdev case, > it > calls a vm_mmap_cdev() function that is a cut down version of > vm_mmap_vnode(). One thing to note is that this case loses the MAC > check for > this type of mmap() (currently only done from DRM) since MAC only checks > mmaps for vnodes. If cdev were to grow a label, then a mmap check for > the > cdev could be added I suppose, though the case of a mmap'ing a vnode that > maps to a cdev would have to be adjusted to make that extra call as well. > > The first cut at the patch added a new MAP_CDEV flag to vm_mmap() that > specified that the handle argument was a cdev rather than a vnode. > However, > this method requires that any kernel code that calls vm_mmap() passing in > flags from userland has to verify that MAP_CDEV isn't passed in from > userland > to avoid potential DOSs from random user processes that result in kernel > panics. Thus, I decided to change vm_mmap() to instead take a objtype_t > parameter that specifies what type of object the handle argument is. > Thus, > for MAP_ANON, the code passes in OBJT_DEFAULT, for vnodes OBJT_VNODE, > and for > cdevs (in drm) OBJT_DEVICE. I've stuck the patch at > http://www.FreeBSD.org/~jhb/patches/mmap_cdev3.patch and am using it > locally You had it typo for ',' instead '.'.. mmap_cdev3,patch http://people.freebsd.org/~jhb/patches/mmap_cdev3,patch Cheers, Mezz > to get X working on my laptop. Any objections or bikeshed^Wsuggestions > for a > different interface? -- mezz7@cox.net - mezz@FreeBSD.org FreeBSD GNOME Team http://www.FreeBSD.org/gnome/ - gnome@FreeBSD.org