Message ID | 20230928173354.217464-1-mlevitsk@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3592707vqu; Thu, 28 Sep 2023 13:54:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9vySa3Cp+amORBqjrDp+sY9V/BwcoT8RWAg+VqblCZgvLrpkwNjcdvGqCWfvBYGKKPlJr X-Received: by 2002:a05:6a00:849:b0:68c:44ed:fb6 with SMTP id q9-20020a056a00084900b0068c44ed0fb6mr3903078pfk.16.1695934491566; Thu, 28 Sep 2023 13:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695934491; cv=none; d=google.com; s=arc-20160816; b=D/yoK7dwdycczdZIcuyswWElw28dz4jDpEOYwPozCGzjk/lyuvWKPpsW6GFc/0oNsy W0QBCkhuINIp0oCt1fBOJxMg+Ua0TpJAKBMtnWIRNkNrpalJJy4yLnICG1j91dyIrIK2 TBSX42pdr0HSLL8ttKTZl4I0qAuodKxQoL/2c+8XD5nniyJ6F16Ql2LY7fAgC0jZ9OmV ZmhRgeHYBKvmltmtjFHPUINaEPnNjlNBpA7WChoclwxo4mlqvbviL+LyFxicKdhjSHiD dTh9LvffbsENV95aC0NE+Bz7pUOuvKzJEUvxxJxoOKYSb35QeSWefZzHKvMxgjMvBoHw rlyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=X1WRNiJYKhsjhu9PboPlV47UeY0+Yci+Xnu7y1tiVFc=; fh=oNJvlPmIFpwfIkAABcMx9rUySvQYt47L4yNhdOcwda8=; b=fXg/D4dHGzY0E84pRXpEO0l/I7VFWbExM6pwVYulmKHpSXE5YbrvaByKkq/hmdOF8y +DXjzsgXEueOrk+3pTkHVaqRnT6uNCrWsD+SXNfzgi9DJe1+EhXpcUglPfUWzCgsKchM S+qZnHgRprSYZ9RUQB6KYg6KFCVTBN9LYXlaXh2ns0KRj4/xBo58GMY/atV4mgEWVxck /JS2QwH7aj/513+MeJDS+dIcbMoPgM7RNj90nAi0euml9CA0wsj3ISRMBFFMWRRSignC YAmKAby0pr1bTxTwpsngY6wvzWrm/tctLJIV8RKKK8a/4t1qsUXAjMGg4JvRnW0p+RtA 10pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jFDwChXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i67-20020a639d46000000b0057c3103bf15si18925804pgd.277.2023.09.28.13.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 13:54:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jFDwChXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BDFC680EFC7F; Thu, 28 Sep 2023 10:36:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232032AbjI1Rf6 (ORCPT <rfc822;pwkd43@gmail.com> + 21 others); Thu, 28 Sep 2023 13:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbjI1Rfw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 13:35:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D5311A3 for <linux-kernel@vger.kernel.org>; Thu, 28 Sep 2023 10:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695922503; 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; bh=X1WRNiJYKhsjhu9PboPlV47UeY0+Yci+Xnu7y1tiVFc=; b=jFDwChXLIB/q5aL9rRCiyNqvUshE2+aC7zXI0OCgppmRIIKKRAwLWpOOaqd65wG8FGgMyA PYNfYXhq6D84SSmU3HPWAJKxJH0bNteP+LcQOthUonJSxKAA4F+STvAJGgz9tVdLOljo1m KDJVUagcuPyd8LPQ7dSJlwvVdH9WU/w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-2-PukTvQVcMWqAKQ7ZZyw2rA-1; Thu, 28 Sep 2023 13:33:59 -0400 X-MC-Unique: PukTvQVcMWqAKQ7ZZyw2rA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D56B85A5BF; Thu, 28 Sep 2023 17:33:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.141]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69CFE14171B6; Thu, 28 Sep 2023 17:33:55 +0000 (UTC) From: Maxim Levitsky <mlevitsk@redhat.com> To: kvm@vger.kernel.org Cc: iommu@lists.linux.dev, "H. Peter Anvin" <hpa@zytor.com>, Sean Christopherson <seanjc@google.com>, Maxim Levitsky <mlevitsk@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.de>, Joerg Roedel <joro@8bytes.org>, x86@kernel.org, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, linux-kernel@vger.kernel.org, Dave Hansen <dave.hansen@linux.intel.com>, Will Deacon <will@kernel.org>, Ingo Molnar <mingo@redhat.com>, Robin Murphy <robin.murphy@arm.com> Subject: [PATCH v2 0/4] AVIC bugfixes and workarounds Date: Thu, 28 Sep 2023 20:33:50 +0300 Message-Id: <20230928173354.217464-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 28 Sep 2023 10:36:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778299402440402952 X-GMAIL-MSGID: 1778316205150299405 |
Series |
AVIC bugfixes and workarounds
|
|
Message
Maxim Levitsky
Sept. 28, 2023, 5:33 p.m. UTC
This patch series includes several fixes to AVIC I found while working on a new version of nested AVIC code. Also while developing it I realized that a very simple workaround for AVIC's errata #1235 exists and included it in this patch series as well. changes since v2: - added 'fixes' tags - reworked workaround for avic errata #1235 - dropped iommu patch as it is no longer needed. Best regards, Maxim Levitsky Maxim Levitsky (4): x86: KVM: SVM: always update the x2avic msr interception x86: KVM: SVM: add support for Invalid IPI Vector interception x86: KVM: SVM: refresh AVIC inhibition in svm_leave_nested() x86: KVM: SVM: workaround for AVIC's errata #1235 arch/x86/include/asm/svm.h | 1 + arch/x86/kvm/svm/avic.c | 68 +++++++++++++++++++++++++++----------- arch/x86/kvm/svm/nested.c | 3 ++ arch/x86/kvm/svm/svm.c | 3 +- arch/x86/kvm/svm/svm.h | 1 + 5 files changed, 55 insertions(+), 21 deletions(-) -- 2.26.3
Comments
On Thu, Sep 28, 2023, Maxim Levitsky wrote: > The following problem exists since x2avic was enabled in the KVM: > > svm_set_x2apic_msr_interception is called to enable the interception of Nit, svm_set_x2apic_msr_interception(). Definitely not worth another version though. > the x2apic msrs. > > In particular it is called at the moment the guest resets its apic. > > Assuming that the guest's apic was in x2apic mode, the reset will bring > it back to the xapic mode. > > The svm_set_x2apic_msr_interception however has an erroneous check for > '!apic_x2apic_mode()' which prevents it from doing anything in this case. > > As a result of this, all x2apic msrs are left unintercepted, and that > exposes the bare metal x2apic (if enabled) to the guest. > Oops. > > Remove the erroneous '!apic_x2apic_mode()' check to fix that. > > This fixes CVE-2023-5090 > > Fixes: 4d1d7942e36a ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode") > Cc: stable@vger.kernel.org > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > --- Reviewed-by: Sean Christopherson <seanjc@google.com>
On Thu, Sep 28, 2023, Maxim Levitsky wrote: > Maxim Levitsky (4): > x86: KVM: SVM: always update the x2avic msr interception > x86: KVM: SVM: add support for Invalid IPI Vector interception > x86: KVM: SVM: refresh AVIC inhibition in svm_leave_nested() Paolo, I assume you'll take the first three directly for 6.6? > x86: KVM: SVM: workaround for AVIC's errata #1235
On Fri, Sep 29, 2023 at 4:09 AM Sean Christopherson <seanjc@google.com> wrote: > > On Thu, Sep 28, 2023, Maxim Levitsky wrote: > > Maxim Levitsky (4): > > x86: KVM: SVM: always update the x2avic msr interception > > x86: KVM: SVM: add support for Invalid IPI Vector interception > > x86: KVM: SVM: refresh AVIC inhibition in svm_leave_nested() > > Paolo, I assume you'll take the first three directly for 6.6? Yes. Paolo > > x86: KVM: SVM: workaround for AVIC's errata #1235 >
Queued patches 1-3, thanks. Paolo