Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp467837rwl; Wed, 9 Aug 2023 18:13:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHo1TRkYBxOL4TUe38sji+iOOSRtjfhaBVcXp0sjCVsYeX4zoG0LQ6kuwIRMx+MXcCKh3Xe X-Received: by 2002:a17:907:16a6:b0:99b:f42d:b3f6 with SMTP id hc38-20020a17090716a600b0099bf42db3f6mr655944ejc.32.1691630010464; Wed, 09 Aug 2023 18:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691630010; cv=none; d=google.com; s=arc-20160816; b=i4xhIj3I8AvPSCtN4CvYHKPM5CeOTeSyzuL0IhS0PkSHveaYBcJ/v3AJ4SvjjBFecx 1F9s/KMGV84efa8uqC56QluQVU0hLBX/SvlSCfsadj0CpdqpsCfJsqxHnHs8pA+Gdtbb TsrE1zptK1pjSJott5WIxPvFyE1O2H6AZVrcyEhJTj7e2EkyHvFP5ud/RE4SlPZlly+x 5JmKnUitppvwOQopmqmvRoOOUjuySWaV/nLd5J6trLocGYB6JpsNzGHYBVt0sTBpUc2L cyUtp1B0sTtrT0+lhbRXTjN+krzloIoPyO2l7zSlnCMzN048uS+y7icbJ/LDP5kGVNB2 vBcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6Po5OwqYn6EeqvIiscVlSRSdsOxz92jYH7zj6nASBvA=; fh=LTxP6FxBLtUdN2GqJaIiNbl4wz+RJiW+yBW1FecbrCw=; b=t41pRe7TnF8+9UO/Il6KMfSnzyF3pWhqG23FNfK+AKrB5Ms096Alkq2hheF1DYPgae EwfBBGMmiQwGwHDXNfNTZDG96xfehMgwvWVd9KmQ9xgxG4mwWpDdSS0RM2IzZmAnIRoN uV2lniLNV6+L32f7X7l5z9hVPCmEHZpL7aVNEqi/2E1VzINiWZOsmZr180aREIfSEj8J YNi1OtEF8bKupg8ltgJISq+lRN+NmkyyUzDU3cTbJuE4EuG8iXLSpYqJsuaov1v6aLqB PtGWVFNjjj8zhcWiWbv8JkdGJQKbFrBvFQ9nM0hvo+66+IWt8MzTRDEM8uFMJjmHOTG0 2H0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OHqJmawV; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a170906838500b009655fcff588si413983ejx.835.2023.08.09.18.13.03; Wed, 09 Aug 2023 18:13:30 -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=@redhat.com header.s=mimecast20190719 header.b=OHqJmawV; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231459AbjHJAC3 (ORCPT + 99 others); Wed, 9 Aug 2023 20:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231377AbjHJAC2 (ORCPT ); Wed, 9 Aug 2023 20:02:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DC51BD for ; Wed, 9 Aug 2023 17:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691625702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Po5OwqYn6EeqvIiscVlSRSdsOxz92jYH7zj6nASBvA=; b=OHqJmawVwqWY5RQGv0+pnwPKeY+pEfOPnblQr7sSzDfR9gk12ysoRD+insU+fK0TgMxJIA Jbz8SV5c60VyMc52PC3B2/LQ7jKbV4Mc9eJSwPeLjRWl+F39GFg19ebAmQRQbnbegcXF+7 OjO7+8EQO9UfHuy4NxMwCfxrQU7TT+c= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-505-Tbafy3cjPIia228yFKA1rA-1; Wed, 09 Aug 2023 20:01:41 -0400 X-MC-Unique: Tbafy3cjPIia228yFKA1rA-1 Received: by mail-vk1-f200.google.com with SMTP id 71dfb90a1353d-4872864aedaso129940e0c.1 for ; Wed, 09 Aug 2023 17:01:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691625700; x=1692230500; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Po5OwqYn6EeqvIiscVlSRSdsOxz92jYH7zj6nASBvA=; b=hROoKU1exQly9XGEZYACG3vNQ6d1gGlNkoTbZGLmjjaV4qI1OBLFQE2bWXBre05IjH bEn7Rdx9qasS6VE6ETHHEUM6y/2xMz8S9ZUEDrm3dl5gFmLHhSk8GSjTWDm4Sv27QVI6 +yjR+98cMAg76p8ZOvm2yk9/wXTNxBXaelN5V7R0dtJxccEMKfJM54WVd0ARWdel0v+F 1f27Hi6rZf6L01b82MoEW931WR8mm58B61CX2+zYkvYxQfL3IiZXpz0cDlN563B6UUDg pD3zJ0ylDQO/AjIgusad+GujsyW2TepnwqetPkFucnv8P/D9UhGCojPfryRsn1DdQX2j zlvw== X-Gm-Message-State: AOJu0YxQTeMeGhnfpVuAY5sJpiMxlAxcD38zLUTLmpbRrbBMS56YDXzb 2fFm+d8PY2X/6tGwfCCQPaf5A6zUBj0LeUQYIxb+cLFJPcL70Gz4n+h7BLBweP9shv4vtI669XC 6WC2RIZXxRRRB5UqJs8Lj4HU+GMlwUauPtvVgbMKn X-Received: by 2002:a67:fc95:0:b0:446:e948:ebd4 with SMTP id x21-20020a67fc95000000b00446e948ebd4mr343996vsp.21.1691625700692; Wed, 09 Aug 2023 17:01:40 -0700 (PDT) X-Received: by 2002:a67:fc95:0:b0:446:e948:ebd4 with SMTP id x21-20020a67fc95000000b00446e948ebd4mr343992vsp.21.1691625700455; Wed, 09 Aug 2023 17:01:40 -0700 (PDT) MIME-Version: 1.0 References: <20230803042732.88515-1-weijiang.yang@intel.com> <20230803042732.88515-5-weijiang.yang@intel.com> <0655c963-78e5-62c9-50af-20d9de8a1001@intel.com> In-Reply-To: <0655c963-78e5-62c9-50af-20d9de8a1001@intel.com> From: Paolo Bonzini Date: Thu, 10 Aug 2023 02:01:29 +0200 Message-ID: Subject: Re: [PATCH v5 04/19] KVM:x86: Refresh CPUID on write to guest MSR_IA32_XSS To: "Yang, Weijiang" Cc: Sean Christopherson , peterz@infradead.org, john.allen@amd.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, rick.p.edgecombe@intel.com, chao.gao@intel.com, binbin.wu@linux.intel.com, Zhang Yi Z Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 Wed, Aug 9, 2023 at 10:56=E2=80=AFAM Yang, Weijiang wrote: > > I'm pretty sure I've advocated for the exact opposite in the past, i.e.= argued > > that KVM's ABI is to not enforce ordering between KVM_SET_CPUID2 and KV= M_SET_MSR. > > But this is becoming untenable, juggling the dependencies in KVM is com= plex and > > is going to result in a nasty bug at some point. > > > > For this series, lets just tighten the rules for XSS, i.e. drop the hos= t_initated > > exemption. And in a parallel/separate series, try to do a wholesale cl= eanup of > > all the cases that essentially allow userspace to do KVM_SET_MSR before= KVM_SET_CPUID2. > OK, will do it for this series and investigate for other MSRs. > Thanks! Remember that, while the ordering between KVM_SET_CPUID2 and KVM_SET_MSR must be enforced(*), the host_initiated path must allow the default (generally 0) value. Paolo (*) this means that you should check guest_cpuid_has even if host_initiated =3D=3D true.