From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756579AbdLPBZY (ORCPT ); Fri, 15 Dec 2017 20:25:24 -0500 Received: from mga07.intel.com ([134.134.136.100]:38601 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755802AbdLPBZV (ORCPT ); Fri, 15 Dec 2017 20:25:21 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,407,1508828400"; d="scan'208";a="3131218" Subject: Re: [PATCH v2 01/17] mm/gup: Fixup p*_access_permitted() To: Linus Torvalds , Dan Williams References: <20171214112726.742649793@infradead.org> <20171214113851.146259969@infradead.org> <20171214124117.wfzcjdczyta2sery@hirez.programming.kicks-ass.net> <20171214143730.s6w7sd6c7b5t6fqp@hirez.programming.kicks-ass.net> <20171214205450.GI3326@worktop> <8eedb9a3-0ba2-52df-58f6-3ed869d18ca3@intel.com> <20171215075147.nzpsmb7asyr6etig@hirez.programming.kicks-ass.net> Cc: Peter Zijlstra , Linux Kernel Mailing List , Thomas Gleixner , the arch/x86 maintainers , Andy Lutomirsky , Borislav Petkov , Greg KH , Kees Cook , Hugh Dickins , Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , "Liguori, Anthony" , Will Deacon , linux-mm , "Kirill A. Shutemov" From: Dave Hansen Message-ID: <629d90d9-df33-2c31-e644-0bc356b61f25@intel.com> Date: Fri, 15 Dec 2017 17:25:20 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/15/2017 05:10 PM, Linus Torvalds wrote: > Because *if* we want to check protection keys, I think we should do > that at the vma layer, partly exactly because the exact implementation > of protection keys is so architecture-specific, and partly because I > don't think it makes sense to check them for every page anyway. So, there are VMA checks against protection keys. The problem _here_ is that we are checking against the VMA (and correctly skipping the PKRU checks) and then _mistakenly_ applying the PTE checks against PKRU. I think the reason we needed VMA and PTE checks was the get_user_pages_fast() path not having a VMA. I need to go re-read the commits, though.