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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 2CBC5C64E7B for ; Mon, 30 Nov 2020 22:48:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8FF9F2073C for ; Mon, 30 Nov 2020 22:48:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FF9F2073C 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 B159C6B005C; Mon, 30 Nov 2020 17:48:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A9BDA8D0002; Mon, 30 Nov 2020 17:48:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EF918D0001; Mon, 30 Nov 2020 17:48:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id 72E466B005C for ; Mon, 30 Nov 2020 17:48:15 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3C43E180AD82F for ; Mon, 30 Nov 2020 22:48:15 +0000 (UTC) X-FDA: 77542574550.18.noise36_44064bd273a5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 14BF5100EC663 for ; Mon, 30 Nov 2020 22:48:15 +0000 (UTC) X-HE-Tag: noise36_44064bd273a5 X-Filterd-Recvd-Size: 4210 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 22:48:13 +0000 (UTC) IronPort-SDR: A3+LqexozXLkhQcrzU3aYXkpViO9Jo5kVQzH5uUFyt+RmV3De2/frLFkMTTRgtP+y6T9eh12nx c5wGcu0NbBMA== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="171939693" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="171939693" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 14:48:12 -0800 IronPort-SDR: gGmBV20c4rH3tKsfMA6R/DzXOXz5E14WS3EFzsab7Ro/qdraHqv2e0F0knX05IFHfHG/BGFvSw NZ7MQjWMozHA== X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404888251" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.122.22]) ([10.212.122.22]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 14:48:10 -0800 Subject: Re: [PATCH v15 05/26] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack To: Borislav Petkov 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 , 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 , Weijiang Yang , Pengfei Xu References: <20201110162211.9207-1-yu-cheng.yu@intel.com> <20201110162211.9207-6-yu-cheng.yu@intel.com> <20201127171012.GD13163@zn.tnic> <98e1b159-bf32-5c67-455b-f798023770ef@intel.com> <20201130181500.GH6019@zn.tnic> From: "Yu, Yu-cheng" Message-ID: <1db3d369-734e-9925-fa14-e799a19ac30c@intel.com> Date: Mon, 30 Nov 2020 14:48:09 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201130181500.GH6019@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 11/30/2020 10:15 AM, Borislav Petkov wrote: > On Sat, Nov 28, 2020 at 08:23:59AM -0800, Yu, Yu-cheng wrote: >> We have X86_BRANCH_TRACKING_USER too. My thought was, X86_CET means any of >> kernel/user shadow stack/ibt. > > It is not about what it means - it is what you're going to use/need. You have > ifdeffery both with X86_CET and X86_SHADOW_STACK_USER. > > This one > > +#ifdef CONFIG_X86_SHADOW_STACK_USER > +#define DISABLE_SHSTK 0 > +#else > +#define DISABLE_SHSTK (1 << (X86_FEATURE_SHSTK & 31)) > +#endif > > for example, is clearly wrong and wants to be #ifdef CONFIG_X86_CET, for > example. Unless I'm missing something totally obvious. Logically, enabling IBT without shadow stack does not make sense, but these features have different CPUIDs, and CONFIG_X86_SHADOW_STACK_USER and CONFIG_X86_BRANCH_TRACKING_USER can be selected separately. Do we want to have only one selection for both features? In other words, we turn on both or neither. Thanks, Yu-cheng > > In any case, you need to analyze what Kconfig defines the code will > need and to what they belong and add only the minimal subset needed. > Our Kconfig symbols space is already nuts so adding more needs to be > absolutely justified. > > Thx. >