Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756607AbZA3Enu (ORCPT ); Thu, 29 Jan 2009 23:43:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751824AbZA3Enl (ORCPT ); Thu, 29 Jan 2009 23:43:41 -0500 Received: from g1t0028.austin.hp.com ([15.216.28.35]:23828 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbZA3Enl (ORCPT ); Thu, 29 Jan 2009 23:43:41 -0500 Subject: Re: [PATCH] Fix OOPS in mmap_region() when merging adjacent VM_LOCKED file segments From: Lee Schermerhorn To: Linus Torvalds Cc: Hugh Dickins , linux-kernel , Maksim Yevmenkin , Nick Piggin , Andrew Morton , Greg Kroah-Hartman , will@crowder-design.com, Rik van Riel , KOSAKI Motohiro , KAMEZAWA Hiroyuki , "David S. Miller" In-Reply-To: References: <1233259410.2315.75.camel@lts-notebook> Content-Type: text/plain Organization: HP/OSLO Date: Thu, 29 Jan 2009 23:43:40 -0500 Message-Id: <1233290620.2315.113.camel@lts-notebook> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 37 On Thu, 2009-01-29 at 15:02 -0800, Linus Torvalds wrote: > > On Thu, 29 Jan 2009, Hugh Dickins wrote: > > > > The problem has always been that file->f_op->mmap(file, vma) on a > > special file can do various strange things, changing surprising > > fields of the struct vma passed to it, changing its mergeability. > > Ahh, you're right. That's somewhat bogus, but it does explain why we have > those two separate merge_vma() calls. > > And as you also point out: > > > Now it may well be that every driver which does something strange > > there already sets one of the VM_SPECIAL flags which prevent merging, > > or can easily be fixed to do so, or otherwise clearly cannot pose a > > problem. > > .. and I think this is the right answer. If a device driver really does > something as odd as play games with the offset that would make merging > wrong, it had better set some of the VM_SPECIAL bits (presumably VM_IO) in > order to never merge at all. Just want to note that install_special_mappings()--used for, e.g., the vdso--sets VM_DONTEXPAND [one of the VM_SPECIAL flags] which, if we want to prevent merging, makes a lot of sense to me. It appears that get_user_pages() will balk at addresses in vmas with VM_IO [and VM_PFNMAP] which might not be what one wants. For example, you can't pre-populate the ptes via make_pages_present() with this flag. Lee -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/