Message ID | 20221103141351.50662-10-mlevitsk@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp561251wru; Thu, 3 Nov 2022 07:17:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ne4Uel1NvZR1m3WOnIMunycAy5V3yF/Zlza4MEp19ivOP4CNxzFvD3CjXWlKyP+d4DBQk X-Received: by 2002:a63:d60b:0:b0:46f:8e44:9ce4 with SMTP id q11-20020a63d60b000000b0046f8e449ce4mr23153820pgg.308.1667485057575; Thu, 03 Nov 2022 07:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667485057; cv=none; d=google.com; s=arc-20160816; b=YDYKnzwLJAhWrd3OGiL6rLdTyPHWtJU1ITv1JPPUwaygt1pme/r2oCuKCNDOb75iU6 nW1MFEYv3fx/N/9U0gRIWliDY537t/WtJtPTjGt4VeAq+LYWPhEPxAO5YOVKrqE/XCvY ZsGNWWozMV0Jxk7HVt9Cz9xP7jc1urfmMAdqiSWybxeD6vDtce1gISl0FcP6I1SPanRa 02WZzC39Mbz1Rw4joVHa+7f5K5XwEuIc6FA4cSXceCWko5xorbpatFIS4r31qYIcfy8n GIJh1m0HZOLzN7A45A7IEVY6edlQN8IiGPPwCSMAHzmP42cHeNjausccxFCfdkvqmgoy RY2g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FT9aNXqnuKXbR3StefJr7RNDWsInEBudWILSzsOk6wI=; b=qU4m7pTYz9FokUf4QveFyYpqRiF5NlEpU6ZxR+O1vDfKODQ9HGRHlAm1GURzdbVt18 LA209Tbhiq6H8YBUNfkhW38iMItT+QmrQtwcbkqVD+5gDMeNeBibKVacmHNlwSBV1l2/ 2QWgs9thwKrCcUr5UjF3lt7WVDgV7ZC7mQFS1aa681+e6vzuhCRZefTHNmWN7J3ZY+0u mPJwVQsBVyG6GtuAdJ7Z1rFz77O0Fr/Z3lXmTO+g32OpXiGa+DaBTcMHWaVn2NtWbXx0 w0fTTlRzxnwKtQlMbj/8KEQYdSdJ6R/fNxNR+k0tZ75riEd2VM7e69Fk3C1owrlvK70t L4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=alSGSvKr; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020aa7888b000000b00554e240fa1bsi1255336pfe.95.2022.11.03.07.17.24; Thu, 03 Nov 2022 07:17:37 -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=alSGSvKr; 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 S231168AbiKCOQT (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 10:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbiKCOPl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 10:15:41 -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 34E6F13F07 for <linux-kernel@vger.kernel.org>; Thu, 3 Nov 2022 07:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667484877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FT9aNXqnuKXbR3StefJr7RNDWsInEBudWILSzsOk6wI=; b=alSGSvKr+WORyuxK6qzt7U9rnJVBew5MzTl0DcjKFrAfbQjSVJ7Y7jbUPPQYf3FfNKIvGQ IdVagG2hx2EdYunpyLFadGtmYI9Dey3tCd9lfhj288klCYN3aPPW0NFKEcC5PK3FZdYXNG WynhUzu8MiTaDZbnlzur5JeqfPwfk84= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-8Qpk1q88NTOADxqZAGJhHA-1; Thu, 03 Nov 2022 10:14:35 -0400 X-MC-Unique: 8Qpk1q88NTOADxqZAGJhHA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2C662A2AD7D; Thu, 3 Nov 2022 14:14:33 +0000 (UTC) Received: from amdlaptop.tlv.redhat.com (dhcp-4-238.tlv.redhat.com [10.35.4.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9E4640C6EC3; Thu, 3 Nov 2022 14:14:29 +0000 (UTC) From: Maxim Levitsky <mlevitsk@redhat.com> To: kvm@vger.kernel.org Cc: Paolo Bonzini <pbonzini@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Chenyi Qiang <chenyi.qiang@intel.com>, Yang Zhong <yang.zhong@intel.com>, x86@kernel.org, Shuah Khan <shuah@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, Maxim Levitsky <mlevitsk@redhat.com>, Colton Lewis <coltonlewis@google.com>, Borislav Petkov <bp@alien8.de>, Peter Xu <peterx@redhat.com>, Sean Christopherson <seanjc@google.com>, Jim Mattson <jmattson@google.com>, linux-kselftest@vger.kernel.org, Ingo Molnar <mingo@redhat.com>, Wei Wang <wei.w.wang@intel.com>, David Matlack <dmatlack@google.com>, stable@vger.kernel.org Subject: [PATCH v2 9/9] KVM: x86: remove exit_int_info warning in svm_handle_exit Date: Thu, 3 Nov 2022 16:13:51 +0200 Message-Id: <20221103141351.50662-10-mlevitsk@redhat.com> In-Reply-To: <20221103141351.50662-1-mlevitsk@redhat.com> References: <20221103141351.50662-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-3.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_H2,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748484812069024920?= X-GMAIL-MSGID: =?utf-8?q?1748484812069024920?= |
Series |
nSVM: Security and correctness fixes
|
|
Commit Message
Maxim Levitsky
Nov. 3, 2022, 2:13 p.m. UTC
It is valid to receive external interrupt and have broken IDT entry,
which will lead to #GP with exit_int_into that will contain the index of
the IDT entry (e.g any value).
Other exceptions can happen as well, like #NP or #SS
(if stack switch fails).
Thus this warning can be user triggred and has very little value.
Cc: stable@vger.kernel.org
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
arch/x86/kvm/svm/svm.c | 9 ---------
1 file changed, 9 deletions(-)
Comments
On 03/11/2022 14:13, Maxim Levitsky wrote: > It is valid to receive external interrupt and have broken IDT entry, > which will lead to #GP with exit_int_into that will contain the index of > the IDT entry (e.g any value). > > Other exceptions can happen as well, like #NP or #SS > (if stack switch fails). > > Thus this warning can be user triggred and has very little value. > > Cc: stable@vger.kernel.org > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > --- > arch/x86/kvm/svm/svm.c | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > index e9cec1b692051c..36f651ce842174 100644 > --- a/arch/x86/kvm/svm/svm.c > +++ b/arch/x86/kvm/svm/svm.c > @@ -3428,15 +3428,6 @@ static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) > return 0; > } > > - if (is_external_interrupt(svm->vmcb->control.exit_int_info) && > - exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR && > - exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH && > - exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI) > - printk(KERN_ERR "%s: unexpected exit_int_info 0x%x " > - "exit_code 0x%x\n", > - __func__, svm->vmcb->control.exit_int_info, > - exit_code); > - > if (exit_fastpath != EXIT_FASTPATH_NONE) > return 1; > This was the only caller of is_external_interrupt() - should the definition be removed also to avoid a 'defined but not used' warning? Regards, Liam
On Sun, 2022-11-06 at 15:53 +0000, Liam Merwick wrote: > On 03/11/2022 14:13, Maxim Levitsky wrote: > > It is valid to receive external interrupt and have broken IDT entry, > > which will lead to #GP with exit_int_into that will contain the index of > > the IDT entry (e.g any value). > > > > Other exceptions can happen as well, like #NP or #SS > > (if stack switch fails). > > > > Thus this warning can be user triggred and has very little value. > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > > --- > > arch/x86/kvm/svm/svm.c | 9 --------- > > 1 file changed, 9 deletions(-) > > > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > > index e9cec1b692051c..36f651ce842174 100644 > > --- a/arch/x86/kvm/svm/svm.c > > +++ b/arch/x86/kvm/svm/svm.c > > @@ -3428,15 +3428,6 @@ static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) > > return 0; > > } > > > > - if (is_external_interrupt(svm->vmcb->control.exit_int_info) && > > - exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR && > > - exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH && > > - exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI) > > - printk(KERN_ERR "%s: unexpected exit_int_info 0x%x " > > - "exit_code 0x%x\n", > > - __func__, svm->vmcb->control.exit_int_info, > > - exit_code); > > - > > if (exit_fastpath != EXIT_FASTPATH_NONE) > > return 1; > > > > This was the only caller of is_external_interrupt() - should the > definition be removed also to avoid a 'defined but not used' warning? I hate to say it but I have seen a warning about an unused function, but I really didn't expect that to come from this patch. I somehow thought that its some leftover in kvm/queue. I'll remove the unused function in a next version. Best regards, Maxim Levitsky > > Regards, > Liam >
On 09/11/2022 09:15, Maxim Levitsky wrote: > On Sun, 2022-11-06 at 15:53 +0000, Liam Merwick wrote: >> On 03/11/2022 14:13, Maxim Levitsky wrote: >>> It is valid to receive external interrupt and have broken IDT entry, >>> which will lead to #GP with exit_int_into that will contain the index of >>> the IDT entry (e.g any value). >>> >>> Other exceptions can happen as well, like #NP or #SS >>> (if stack switch fails). >>> >>> Thus this warning can be user triggred and has very little value. >>> >>> Cc: stable@vger.kernel.org >>> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> >>> --- >>> arch/x86/kvm/svm/svm.c | 9 --------- >>> 1 file changed, 9 deletions(-) >>> >>> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c >>> index e9cec1b692051c..36f651ce842174 100644 >>> --- a/arch/x86/kvm/svm/svm.c >>> +++ b/arch/x86/kvm/svm/svm.c >>> @@ -3428,15 +3428,6 @@ static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) >>> return 0; >>> } >>> >>> - if (is_external_interrupt(svm->vmcb->control.exit_int_info) && >>> - exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR && >>> - exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH && >>> - exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI) >>> - printk(KERN_ERR "%s: unexpected exit_int_info 0x%x " >>> - "exit_code 0x%x\n", >>> - __func__, svm->vmcb->control.exit_int_info, >>> - exit_code); >>> - >>> if (exit_fastpath != EXIT_FASTPATH_NONE) >>> return 1; >>> >> >> This was the only caller of is_external_interrupt() - should the >> definition be removed also to avoid a 'defined but not used' warning? > > I hate to say it but I have seen a warning about an unused function, > but I really didn't expect that to come from this patch. > I somehow thought that its some leftover in kvm/queue. > > I'll remove the unused function in a next version. > Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index e9cec1b692051c..36f651ce842174 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3428,15 +3428,6 @@ static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) return 0; } - if (is_external_interrupt(svm->vmcb->control.exit_int_info) && - exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR && - exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH && - exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI) - printk(KERN_ERR "%s: unexpected exit_int_info 0x%x " - "exit_code 0x%x\n", - __func__, svm->vmcb->control.exit_int_info, - exit_code); - if (exit_fastpath != EXIT_FASTPATH_NONE) return 1;