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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1474DEB64D7 for ; Fri, 23 Jun 2023 22:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbjFWWSj (ORCPT ); Fri, 23 Jun 2023 18:18:39 -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-Google-Smtp-Source: ACHHUZ46TT1FeT6gOPViLTwUfS+blvVlh1AdCYgrROR9OSlBn102s3to2/Rcbxsp+gEcv0kS3C7gX9F/698= 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" 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?