Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6077690ybf; Thu, 5 Mar 2020 12:38:57 -0800 (PST) X-Google-Smtp-Source: ADFU+vuQObmjUCY+XbEeGqeqafz3BtHJ3ukNJGvHHP+rkQA2fQA82iA8jF9u0dMFO/xfWxnnApxJ X-Received: by 2002:a05:6830:616:: with SMTP id w22mr241254oti.215.1583440737270; Thu, 05 Mar 2020 12:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583440737; cv=none; d=google.com; s=arc-20160816; b=YVs6/yBCQu8aABEF2E/xBDaa4xbfpeHWdGJnimhW71y+tSRHQoZWJhKSC0Df/cJ40z n4hqETSavabPDnRrJC09x1MgNxarpyeBarxhUYdPfCHalK8rCahLs5sxhkIqsQn1uE1e heMF5sPHxg+N1vGODliX+dJIupAeylYMg0uoPW2PPWbXAAbVhclHUxS23ctus+Hd/dqv Q1gEHCDy7fJXDncgGSyGm+3HXKIuQhRlxoGusKRMx3CW6JsN3yVnDZFc7XCe1qjIM3DB MJzN7/Nl3qvEdG/eeR0jrDpex+ZASYn/qdfNIXEMi2C/D92sMZfBcKsUxlb0agL687eq E+8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=Zgn46v+nXNyUIS9sqxBeYkEvOlwgHSyxNu5LkwW16MY=; b=MPV87zAqkL/Xcmg95ht8S+YJhCaNJgQRAFB9CKIVgNseCjSQ1afqV8D6UUqSJqkTUZ RjK33G7xAkEntqPAd8lg0GU0MjdrinfEH8klytO/UtP1+FNQoEQpdX12Qdv8dlL4uEo3 Zg7gZHuiad9D/2ta/HmaniHTEOGANz4BbwZkdyChI9WNu1OlCnAX4/nQBLRjMGeUVctQ x6n8pOErW1n03rnMcZcs0k/la/9NnuSBQyTdnkRZUzF7HO6cqOEcrsOzO8MKMedvZ7xp xeSo+6FOu2RvAJtRU88doAyWDdkurHm42yZRkOnE04R9A+EkHWnQNJfky6zP10Z0NUbX O0Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si31957oto.105.2020.03.05.12.38.44; Thu, 05 Mar 2020 12:38:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726179AbgCEUiR (ORCPT + 99 others); Thu, 5 Mar 2020 15:38:17 -0500 Received: from mga07.intel.com ([134.134.136.100]:46441 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbgCEUiR (ORCPT ); Thu, 5 Mar 2020 15:38:17 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 12:38:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,519,1574150400"; d="scan'208";a="229822632" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga007.jf.intel.com with ESMTP; 05 Mar 2020 12:38:15 -0800 Message-ID: <607b3094a06dd62dfabb0fd6991429f464355a0c.camel@intel.com> Subject: Re: [RFC PATCH v9 05/27] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack protection From: Yu-cheng Yu To: Dave Hansen , 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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , x86-patch-review@intel.com Date: Thu, 05 Mar 2020 12:38:14 -0800 In-Reply-To: <597fb45a-cb94-e8e7-8e80-45a26766d32a@intel.com> References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-6-yu-cheng.yu@intel.com> <597fb45a-cb94-e8e7-8e80-45a26766d32a@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-02-26 at 09:03 -0800, Dave Hansen wrote: > On 2/5/20 10:19 AM, Yu-cheng Yu wrote: > > Introduce Kconfig option: X86_INTEL_SHADOW_STACK_USER. > > > > Shadow Stack (SHSTK) provides protection against function return address > > corruption. It is active when the kernel has this feature enabled, and > > both the processor and the application support it. When this feature is > > enabled, legacy non-SHSTK applications continue to work, but without SHSTK > > protection. > > > > The user-mode SHSTK protection is only implemented for the 64-bit kernel. > > IA32 applications are supported under the compatibility mode. > > I think what you're trying to say here is that the hardware supports > shadow stacks with 32-bit kernels. However, this series does not > include that support and we have no plans to add it. > > Right? Yes. > > I'll let others weigh in, but I rather dislike the use of acronyms here. > I'd much rather see the english "shadow stack" everywhere than SHSTK. I will change to shadow stack. > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 5e8949953660..6c34b701c588 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -1974,6 +1974,28 @@ config X86_INTEL_TSX_MODE_AUTO > > side channel attacks- equals the tsx=auto command line parameter. > > endchoice > > > > +config X86_INTEL_CET > > + def_bool n > > + > > +config ARCH_HAS_SHSTK > > + def_bool n > > + > > +config X86_INTEL_SHADOW_STACK_USER > > + prompt "Intel Shadow Stack for user-mode" > > Nit: this whole thing is to support more than a single stack. I'd make > this plural at least in the text: "shadow stacks". OK. > > > + def_bool n > > + depends on CPU_SUP_INTEL && X86_64 > > + select ARCH_USES_HIGH_VMA_FLAGS > > + select X86_INTEL_CET > > + select ARCH_HAS_SHSTK > > + ---help--- > > + Shadow Stack (SHSTK) provides protection against program > > + stack corruption. It is active when the kernel has this > > + feature enabled, and the processor and the application > > + support it. When this feature is enabled, legacy non-SHSTK > > + applications continue to work, but without SHSTK protection. > > + > > + If unsure, say y. > > This is missing a *lot* of information. > > What matters to someone turning this on? > > 1. It's a hardware feature. This only matters if you have the right > hardware > 2. It's a security hardening feature. You dance around this, but need > to come out and say it. > 3. Apps must be enabled to use it. You get no protection "for free" on > old userspace. > 4. The hardware supports user and kernel, but this option is for > userspace only. I will update the help text. Yu-cheng