From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756134AbcAHTwP (ORCPT ); Fri, 8 Jan 2016 14:52:15 -0500 Received: from www.linutronix.de ([62.245.132.108]:39723 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932926AbcAHTwL (ORCPT ); Fri, 8 Jan 2016 14:52:11 -0500 Date: Fri, 8 Jan 2016 20:51:16 +0100 (CET) From: Thomas Gleixner To: Dave Hansen cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, dave.hansen@linux.intel.com, torvalds@linux-foundation.org, akpm@linux-foundation.org, keescook@google.com, luto@amacapital.net Subject: Re: [PATCH 31/31] x86, pkeys: execute-only support In-Reply-To: <20160107000148.ED5D13DF@viggo.jf.intel.com> Message-ID: References: <20160107000104.1A105322@viggo.jf.intel.com> <20160107000148.ED5D13DF@viggo.jf.intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Jan 2016, Dave Hansen wrote: > > Signed-off-by: Dave Hansen > diff -puN arch/x86/mm/fault.c~pkeys-79-xonly arch/x86/mm/fault.c > --- a/arch/x86/mm/fault.c~pkeys-79-xonly 2016-01-06 15:50:16.799660453 -0800 > +++ b/arch/x86/mm/fault.c 2016-01-06 15:50:16.810660949 -0800 > @@ -14,6 +14,8 @@ > #include /* prefetchw */ > #include /* exception_enter(), ... */ > #include /* faulthandler_disabled() */ > +#include /* PKEY_* */ > +#include > > #include /* boot_cpu_has, ... */ > #include /* dotraplinkage, ... */ > @@ -23,6 +25,7 @@ > #include /* emulate_vsyscall */ > #include /* struct vm86 */ > #include /* vma_pkey() */ > +#include /* fpregs_active() */ These include changes are presumably leftovers from an earlier version. At least I can't see a reason why we would need them for the change below. > #define CREATE_TRACE_POINTS > #include > @@ -1108,6 +1111,16 @@ access_error(unsigned long error_code, s > */ > if (error_code & PF_PK) > return 1; > + > + if (!(error_code & PF_INSTR)) { > + /* > + * Assume all accesses require either read or execute > + * permissions. This is not an instruction access, so > + * it requires read permissions. > + */ > + if (!(vma->vm_flags & VM_READ)) > + return 1; > + } Except for the above nit: Reviewed-by: Thomas Gleixner