From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 0DE357D071 for ; Wed, 11 Jul 2018 16:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732979AbeGKQQd (ORCPT ); Wed, 11 Jul 2018 12:16:33 -0400 Received: from mga06.intel.com ([134.134.136.31]:45856 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbeGKQQc (ORCPT ); Wed, 11 Jul 2018 12:16:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 09:11:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="66141725" Received: from 2b52.sc.intel.com ([143.183.136.52]) by orsmga003.jf.intel.com with ESMTP; 11 Jul 2018 09:11:29 -0700 Message-ID: <1531325272.13297.27.camel@intel.com> Subject: Re: [RFC PATCH v2 15/27] mm/mprotect: Prevent mprotect from changing shadow stack From: Yu-cheng Yu To: Peter Zijlstra , Dave Hansen Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , "Ravi V. Shankar" , Vedvyas Shanbhogue Date: Wed, 11 Jul 2018 09:07:52 -0700 In-Reply-To: <20180711091232.GU2476@hirez.programming.kicks-ass.net> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-16-yu-cheng.yu@intel.com> <04800c52-1f86-c485-ba7c-2216d8c4966f@linux.intel.com> <20180711091232.GU2476@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Wed, 2018-07-11 at 11:12 +0200, Peter Zijlstra wrote: > On Tue, Jul 10, 2018 at 04:10:08PM -0700, Dave Hansen wrote: > > > > On 07/10/2018 03:26 PM, Yu-cheng Yu wrote: > > > > > > Signed-off-by: Yu-cheng Yu > > This still needs a changelog, even if you think it's simple. > > > > > > --- a/mm/mprotect.c > > > +++ b/mm/mprotect.c > > > @@ -446,6 +446,15 @@ static int do_mprotect_pkey(unsigned long > > > start, size_t len, > > >   error = -ENOMEM; > > >   if (!vma) > > >   goto out; > > > + > > > + /* > > > +  * Do not allow changing shadow stack memory. > > > +  */ > > > + if (vma->vm_flags & VM_SHSTK) { > > > + error = -EINVAL; > > > + goto out; > > > + } > > > + > > I think this is a _bit_ draconian.  Why shouldn't we be able to use > > protection keys with a shadow stack?  Or, set it to PROT_NONE? > Right, and then there's also madvise() and some of the other > accessors. > > Why do we need to disallow this? AFAICT the worst that can happen is > that a process wrecks itself, so what? Agree.  I will remove the patch. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html