Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965380AbbLRVMq (ORCPT ); Fri, 18 Dec 2015 16:12:46 -0500 Received: from mga02.intel.com ([134.134.136.20]:1778 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965194AbbLRVMo (ORCPT ); Fri, 18 Dec 2015 16:12:44 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,447,1444719600"; d="scan'208";a="844300731" Subject: Re: Rethinking sigcontext's xfeatures slightly for PKRU's benefit? To: Linus Torvalds , Andy Lutomirski References: <56736BD1.5080700@linux.intel.com> <5673750B.606@linux.intel.com> <567453AF.5060808@linux.intel.com> <56746774.8000707@linux.intel.com> Cc: "H. Peter Anvin" , Oleg Nesterov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Brian Gerst , "linux-kernel@vger.kernel.org" , Christoph Hellwig From: Dave Hansen Message-ID: <567476CC.8080805@linux.intel.com> Date: Fri, 18 Dec 2015 13:12:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1372 Lines: 32 On 12/18/2015 01:04 PM, Linus Torvalds wrote: > On Fri, Dec 18, 2015 at 12:49 PM, Andy Lutomirski wrote: >> >> IOW, I like my idea in which signal delivery always sets PKRU to the >> application-requested-by-syscall values and sigreturn restores it. > > So I don't mind that, as long as the whole "sigreturn restores it" is > part of things. > > Your original email with the suggestion to *not* resture PKRU I didn't > like. Setting it and restoring it is fine. > > I do wonder if you need an explicit value, though. I think it's > reasonable to say that PKRU value 0 is special. It's what we'd start > processes with, and why not just say that it's what we run signal > handlers in? > > Would any other value ever make sense, really? Having a PKRU with the execute-only permissions set is the only one I can think of. For a system with a _dedicated_ PKEY for execute-only, this is easy and could even be made a part of init_fpstate with no other code changes. But, if we are picking out an execute-only pkey more dynamically, we've got to keep the default value for the entire process somewhere. -- 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/