From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C1CC433DB for ; Fri, 5 Feb 2021 00:05:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 903F864FB6 for ; Fri, 5 Feb 2021 00:05:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 903F864FB6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DC6A96B0006; Thu, 4 Feb 2021 19:05:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D764C6B006C; Thu, 4 Feb 2021 19:05:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C651D6B006E; Thu, 4 Feb 2021 19:05:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id ABD7A6B0006 for ; Thu, 4 Feb 2021 19:05:10 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 75C14181AEF1A for ; Fri, 5 Feb 2021 00:05:10 +0000 (UTC) X-FDA: 77782269180.25.4DB3CCB Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf07.hostedemail.com (Postfix) with ESMTP id C1532A0000FB for ; Fri, 5 Feb 2021 00:05:08 +0000 (UTC) IronPort-SDR: SROs371zMRdQg34iuYN5ryck+RMdLhiW2DzjbJdGb4uwRTXDVMyOxU2S8O0DOnt9Z2Qxdk7ekE DeoYtSsndAaA== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="160510266" X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="160510266" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 16:05:07 -0800 IronPort-SDR: 9A2nuYpdchNnFhxQ1CGsl6qyFnW7iy5YcAe2d5gQVNVNpooWZO9qu480lEdh9kTYpwCl6v+xI5 XWocliCxxHWw== X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="434165916" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.100.6]) ([10.209.100.6]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 16:05:05 -0800 Subject: Re: [PATCH v19 02/25] x86/cet/shstk: Add Kconfig option for user-mode control-flow protection To: Kees Cook 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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu References: <20210203225547.32221-1-yu-cheng.yu@intel.com> <20210203225547.32221-3-yu-cheng.yu@intel.com> <202102041154.F0264AC33@keescook> From: "Yu, Yu-cheng" Message-ID: <19793d76-6793-20a0-059c-cd153cf36a8b@intel.com> Date: Thu, 4 Feb 2021 16:05:04 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <202102041154.F0264AC33@keescook> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C1532A0000FB X-Stat-Signature: zxe6nyh9xjnmzoup9oayburauuzupkrn Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mga12.intel.com; client-ip=192.55.52.136 X-HE-DKIM-Result: none/none X-HE-Tag: 1612483508-298883 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2/4/2021 11:56 AM, Kees Cook wrote: > On Wed, Feb 03, 2021 at 02:55:24PM -0800, Yu-cheng Yu wrote: >> Shadow Stack provides protection against function return address >> corruption. It is active when the processor supports it, the kernel has >> CONFIG_X86_CET enabled, and the application is built for the feature. >> This is only implemented for the 64-bit kernel. When it is enabled, legacy >> non-Shadow Stack applications continue to work, but without protection. >> >> Signed-off-by: Yu-cheng Yu >> --- >> arch/x86/Kconfig | 22 ++++++++++++++++++++++ >> arch/x86/Kconfig.assembler | 5 +++++ >> 2 files changed, 27 insertions(+) >> >> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >> index 21f851179ff0..074b3c0e6bf6 100644 >> --- a/arch/x86/Kconfig >> +++ b/arch/x86/Kconfig >> @@ -1951,6 +1951,28 @@ config X86_SGX >> >> If unsure, say N. >> >> +config ARCH_HAS_SHADOW_STACK >> + def_bool n >> + >> +config X86_CET >> + prompt "Intel Control-flow protection for user-mode" >> + def_bool n >> + depends on X86_64 >> + depends on AS_WRUSS >> + select ARCH_USES_HIGH_VMA_FLAGS >> + select ARCH_HAS_SHADOW_STACK > > This seems backwards to me? Shouldn't 'config X86_64' do the 'select > ARCH_HAS_SHADOW_STACK' and 'config X86_CET' do a 'depends on > ARCH_HAS_SHADOW_STACK' instead? I will change it. Thanks! -- Yu-cheng