Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753247AbdLMOnp (ORCPT ); Wed, 13 Dec 2017 09:43:45 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:39278 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752749AbdLMOnm (ORCPT ); Wed, 13 Dec 2017 09:43:42 -0500 X-Google-Smtp-Source: ACJfBovEqD3mxmX885vqYEj5ARXBZ6/oQZ25X8G4rE1cOszOdwsKN13tdB4lBRalgRqBCe32yA3isA== Date: Wed, 13 Dec 2017 17:43:39 +0300 From: "Kirill A. Shutemov" To: Peter Zijlstra , Dan Williams Cc: Dave Hansen , Andy Lutomirski , Thomas Gleixner , LKML , X86 ML , Linus Torvalds , Borislav Petkov , Greg KH , Kees Cook , Hugh Dickins , Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , "linux-mm@kvack.org" , kirill.shutemov@linux.intel.com, aneesh.kumar@linux.vnet.ibm.com Subject: Re: [patch 05/16] mm: Allow special mappings with user access cleared Message-ID: <20171213144339.ii5gk2arwg5ivr6b@node.shutemov.name> References: <20171212173221.496222173@linutronix.de> <20171212173333.669577588@linutronix.de> <20171213122211.bxcb7xjdwla2bqol@hirez.programming.kicks-ass.net> <20171213125739.fllckbl3o4nonmpx@node.shutemov.name> <20171213143455.oqigy6m53qhuu7k4@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171213143455.oqigy6m53qhuu7k4@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20171208 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 36 On Wed, Dec 13, 2017 at 03:34:55PM +0100, Peter Zijlstra wrote: > On Wed, Dec 13, 2017 at 03:57:40PM +0300, Kirill A. Shutemov wrote: > > On Wed, Dec 13, 2017 at 01:22:11PM +0100, Peter Zijlstra wrote: > > > > get_user_pages_fast() will ultimately end up doing > > > pte_access_permitted() before getting the page, follow_page OTOH does > > > not do this, which makes for a curious difference between the two. > > > > > > So I'm thinking we want the below irrespective of the VM_NOUSER patch, > > > but with VM_NOUSER it would mean write(2) will no longer be able to > > > access the page. > > > > Oh.. > > > > We do call pte_access_permitted(), but only for write access. > > See can_follow_write_pte(). > > My can_follow_write_pte() looks like: > > static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) > { > return pte_write(pte) || > ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); > } > > am I perchance looking at the wrong tee? I'm looking at Linus' tree. It was changed recently: 5c9d2d5c269c ("mm: replace pte_write with pte_access_permitted in fault + gup paths") +Dan. -- Kirill A. Shutemov