Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13074489rwd; Fri, 23 Jun 2023 15:26:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KsgDHHm+5FkDCYyKfOXzvuXFiXHlORNpKryVIPFexrT4Mix/CjAmTvuRuJ7I4Dx4gErWG X-Received: by 2002:a05:6808:1987:b0:3a1:9540:feb1 with SMTP id bj7-20020a056808198700b003a19540feb1mr5131566oib.14.1687559167591; Fri, 23 Jun 2023 15:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687559167; cv=none; d=google.com; s=arc-20160816; b=E6R08vVc8XQLfP67OjbsrmokAn99I6SEjoEVvWkCXdLEJgDhMuGUsa3F7IGo4m/Y7k KA+5wTquW6+55xO9ENBLHOiutaDOL7caVuDjstwccZHwntZJjWCRBmxMM5KA3wuddMWZ bWrvAWQhm1H8nLHzA5JrpQISwcxMif27XxcnLBf9lNSTKi8Y1lVmjd9m+eQEpIdKbXba wFH42NOfsTaEWZB0IoFNUQ5uVdhYeeG8teBT/nwVWXkIZX1cYGLwd6Z4A1bfwk+KIRv5 x9+aCIZjcXViGt+K+Iz5SCLrzeYBjgLl9SJMeRddDAbFfQH1N6oSxLLgp09HedpSVVly OrNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=mj7gT4pHcHTYHuiGyjzIPdldK7uwKkEsb4SrQHW5+SA=; fh=f8g8z+zNSXQ9ZMS16bG/8Jv6XWIrssQm6+We10Xawww=; b=s2hpoMSNpneCkvHoeiXNSzHzdaxAgH1ssnAngYuG4MvOkp8WQSiIQMDCq9JJvEQfGm p4s7boTTN1t6FkgtUnu1uSaWC1ZT8kuWrK79pCYjv63dyp5u/ttVbEdMzXpkUgGlR2mU bq276wWn3lWxqmlgJe2mCciuNxVOU9T7ybNfCPAvVYRVGSnSg4nPBdc3R4ndjWJsq/g1 XIUQylwf7YKwJ5URBFSXykIjLPFD0cv/fDWukG4wjEmmVc7tYwj/hHpfslQZv520PZEf Ut12xI1Zyul6xUEKibWpRuZmGmMjMFI8gW2FydT2/ISwmCDPtEWIR7mAv0TQispvQclt 4b3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Sps2XRR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020a17090ade9400b0025bd4685a6dsi405730pjv.105.2023.06.23.15.25.54; Fri, 23 Jun 2023 15:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Sps2XRR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232272AbjFWWSh (ORCPT + 99 others); Fri, 23 Jun 2023 18:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231750AbjFWWSf (ORCPT ); Fri, 23 Jun 2023 18:18:35 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B39E2693 for ; Fri, 23 Jun 2023 15:18:31 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-25eb77bccbfso586066a91.2 for ; Fri, 23 Jun 2023 15:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687558710; x=1690150710; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=mj7gT4pHcHTYHuiGyjzIPdldK7uwKkEsb4SrQHW5+SA=; b=Sps2XRR6fmfomVCI+TF4w+QePG0mmoi5JN/AKa93y6+EFjXVxxwChZc5aWV6Kj49M8 Zxj9iOdM1+YEfwvUWAoHRZXUQrOSDTF4bxS9c3GYbxaZe2UAlBGNZl9J6t6gOYEEVgX9 Zq+QboeFeZBRNBJcGwyzxoBt2dcIi87CSspFR4H/8CyxB+GQFqVAhRT3PPaQBeJWkdNu UvUvhiOfX2niTzVKlemEK+sfkpBLTDN/mV0iG12dkcKxRxulhBGRGpjnwLOwBA8Hufpc nmh4Z1m0w9MKeuARqzb9Kul/i9cjfH3VZO7BaOgKv6GKJH1iRyHMwe59Ka1V6AV5+Ffw dMpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687558710; x=1690150710; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mj7gT4pHcHTYHuiGyjzIPdldK7uwKkEsb4SrQHW5+SA=; b=hIT8P01XFbdWiRhM9d+U3bdZuH4tQan4q22NFuqEWGsDhcSozr1wQ2OaorECbV11Ap 4D4tRuSQZY6gSQtvD101CsZ+CJXWzGMtxj372/YuT1dJmxcN72X+ZQoOIv6HwDPkYW8n LhxFuIsndh6odl2exHywVzEuYUeZLtSZNZOZ7Mp/SBTJThILI7zRZEt3LCZHZPCDJxmY ViOqsIXYTVh2Ppf61EQ2AZJxOX7VTTFQptb1IbMOkGqdW/XfPSo9p25d5IN10kcyAX2I MKmUiiQ7ALsr7ON6mXoZxsBYnvpje5Fp1G+cwdrv6tw3AVHZjeX2HfvU8XP1rtzCYfw8 KyWA== X-Gm-Message-State: AC+VfDzAE4X4F60SnlC3v51cnh+OwLivgcliyknNHpi6pOYY+jDpETzr Dows90Q7zq66f6fk+uzyn4GL/R1t9/A= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:d482:b0:25e:1d89:76a3 with SMTP id s2-20020a17090ad48200b0025e1d8976a3mr3222708pju.6.1687558710649; Fri, 23 Jun 2023 15:18:30 -0700 (PDT) Date: Fri, 23 Jun 2023 15:18:29 -0700 In-Reply-To: <9ef2faeaa38e667bd4daa8ee338d4cade452c76c.camel@intel.com> Mime-Version: 1.0 References: <20230524155339.415820-1-john.allen@amd.com> <20230524155339.415820-7-john.allen@amd.com> <161174d013dff42ddfd2950fe33a8054f45c223e.camel@intel.com> <9ef2faeaa38e667bd4daa8ee338d4cade452c76c.camel@intel.com> Message-ID: Subject: Re: [RFC PATCH v2 6/6] KVM: SVM: Add CET features to supported_xss From: Sean Christopherson To: Rick P Edgecombe Cc: "john.allen@amd.com" , Weijiang Yang , "bp@alien8.de" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "thomas.lendacky@amd.com" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "andrew.cooper3@citrix.com" Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 09, 2023, Rick P Edgecombe wrote: > On Fri, 2023-06-09 at 10:34 -0500, John Allen wrote: > > > Is setting XFEATURE_MASK_CET_KERNEL here ok? The host kernel will not > > > support XFEATURE_MASK_CET_KERNEL. I guess after this there is a small > > > window of time where host IA32_XSS could have non-host supported > > > supervisor state. > > > > > > Sort of separately, how does SVM work with respect to saving and > > > restoring guest supervisor CET state (I mean the CET_S stuff)? > > > > Apart from a minor exception involving SEV-ES, we are piggybacking on the > > state saving/restoring in Yang Weijiang's x86/VMX series. So by inspection, > > it looks like guest supervisor support is broken as the supervisor XSAVES > > state and MSRs are not included in that series. I currently don't have a > > way to test this case, but I think there are operating systems that support > > it. I'll work on getting a guest set up that can actually test this and > > hopefully have working guest supervisor support in the next version of the > > series. > > Hmm, interesting. VMX has some separate non-xsaves thing to save and > restore the guests supervisor CET state, so Weijiang's series doesn't > use the xsaves supervisor CET support. Heh, that and Weijiang's series is a wee bit incomplete. > Also, since the host might have CR4.CET set for its own reasons, if the host > handled an exit with the the guests MSR_IA32_S_CET set it could suddenly be > subjected to CET enforcement that it doesn't expect. Waiting to restore it > until returning to the guest is too late. > > At least that's the reasoning on the VMX side as I understand it The APM doesn't come right out and say it, but I assume/hope that S_CET is saved on VMRUN and loaded on #VMEXIT, i.e. is the same as VMX for all intents and purposes. The host save state definitely has a field for S_CET, and VMRUN documents that the guest values are loaded, I just can't find anything in the APM that explicitly states how host S_CET and friends are handled. E.g. in theory, they could have been shoved into VMSAVE+VMLOAD, though I very much doubt that's the case. John?