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 85C76C8301C for ; Tue, 1 Dec 2020 22:37:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E25C20671 for ; Tue, 1 Dec 2020 22:37:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgLAWhV (ORCPT ); Tue, 1 Dec 2020 17:37:21 -0500 Received: from mga01.intel.com ([192.55.52.88]:28888 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727364AbgLAWhU (ORCPT ); Tue, 1 Dec 2020 17:37:20 -0500 IronPort-SDR: NmKS38+hxB13afkY7qpMGkYkb0vuiArue2OrNlKjpweFJ5vS8+YTeMxaKE9Hgvc/QJbQuPtSbv c9GTv7defVIw== X-IronPort-AV: E=McAfee;i="6000,8403,9822"; a="191126641" X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="191126641" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 14:35:23 -0800 IronPort-SDR: gGWS34BVjbVpM4Uca8QWpPqLLyH3hOV2FpuAteOqq+yvG+kmvBOlnGPfBBytF1SEuTL/OtAik5 zNhntxWdRYwQ== X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="537714613" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.4.202]) ([10.209.4.202]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 14:35:20 -0800 Subject: Re: [PATCH v15 03/26] x86/fpu/xstate: Introduce CET MSR XSAVES supervisor states 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 , Weijiang Yang , Pengfei Xu References: <20201110162211.9207-1-yu-cheng.yu@intel.com> <20201110162211.9207-4-yu-cheng.yu@intel.com> <3b83517e-17d6-3b53-6dbf-8ad727707b16@intel.com> <705fdfec-25a4-60bc-868e-af515c731273@intel.com> From: "Yu, Yu-cheng" Message-ID: <87f6309f-d5b4-a66f-99a1-d96a655290b6@intel.com> Date: Tue, 1 Dec 2020 14:35:18 -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: <705fdfec-25a4-60bc-868e-af515c731273@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 12/1/2020 2:26 PM, Dave Hansen wrote: > On 11/30/20 3:16 PM, Yu, Yu-cheng wrote: >>> >>> Do we have any other spots in the kernel where we care about: >>> >>>     boot_cpu_has(X86_FEATURE_SHSTK) || >>>     boot_cpu_has(X86_FEATURE_IBT) >>> >>> ?  If so, we could also address this by declaring a software-defined >>> X86_FEATURE_CET and then setting it if SHSTK||IBT is supported, then we >>> just put that one feature in xsave_cpuid_features[]. >>> >> >> These features have different CPUIDs but are complementary parts.  I >> don't know if someday there will be shadow-stack-only CPUs, but an >> IBT-only CPU is weird.  What if the kernel checks that the CPU has both >> features and presents only one feature flag (X86_FEATURE_CET), no >> X86_FEATURE_SHSTK or X86_FEATURE_IBT? > > Logically, that's probably fine. But, X86_FEATURE_IBT/SHSTK are in a > non-scattered leaf, so we'll kinda define them whether we like it or > not. We'd have to go out of our way to *not* define them. > After more thoughts, I think it is better to just add X86_FEATURE_CET and not more. We cannot predict what is going to happen later. So, like what you suggested, X86_FEATURE_CET means (X86_FEATURE_SHSTK | X86_FEATURE_IBT). Thanks, Yu-cheng