From owner-freebsd-arch@FreeBSD.ORG Mon Mar 28 22:44:13 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 8287C16A4CE for ; Mon, 28 Mar 2005 22:44:13 +0000 (GMT) Received: from mail26.sea5.speakeasy.net (mail26.sea5.speakeasy.net [69.17.117.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F2BD43D2F for ; Mon, 28 Mar 2005 22:44:13 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 6141 invoked from network); 28 Mar 2005 22:44:12 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender )AES256-SHA encrypted SMTP for ; 28 Mar 2005 22:44:10 -0000 Received: from [10.50.41.231] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j2SMi0Iu003376; Mon, 28 Mar 2005 17:44:05 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: "Jeremy Messenger" Date: Mon, 28 Mar 2005 17:41:19 -0500 User-Agent: KMail/1.6.2 References: <200503281734.45926.jhb@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <200503281741.19443.jhb@FreeBSD.org> X-Spam-Status: No, score=-102.8 required=4.2 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx 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:44:13 -0000 On Monday 28 March 2005 05:39 pm, Jeremy Messenger wrote: > 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 Heh, fixed. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org