From: Peter Xu <peterx@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
peterx@redhat.com,
Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Steffen Dirkwinkel <kernel-bugs@steffen.cc>
Subject: [PATCH 2/2] KVM: X86: Fix null pointer reference for KVM_GET_MSRS
Date: Sun, 25 Oct 2020 14:53:34 -0400 [thread overview]
Message-ID: <20201025185334.389061-3-peterx@redhat.com> (raw)
In-Reply-To: <20201025185334.389061-1-peterx@redhat.com>
kvm_msr_ignored_check() could trigger a null pointer reference if ignore_msrs=Y
and report_ignore_msrs=Y when try to fetch an invalid feature msr using the
global KVM_GET_MSRS. Degrade the error report to not rely on vcpu since that
information (index, rip) is not as important as msr index/data after all.
Fixes: 12bc2132b15e0a96
Reported-by: Steffen Dirkwinkel <kernel-bugs@steffen.cc>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/x86/kvm/x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ce856e0ece84..5993fbd6d2c5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -259,8 +259,8 @@ static int kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
if (ignore_msrs) {
if (report_ignored_msrs)
- vcpu_unimpl(vcpu, "ignored %s: 0x%x data 0x%llx\n",
- op, msr, data);
+ kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n",
+ op, msr, data);
/* Mask the error */
return 0;
} else {
--
2.26.2
next prev parent reply other threads:[~2020-10-25 18:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-25 18:53 [PATCH 0/2] Fix null pointer dereference in kvm_msr_ignored_check Peter Xu
2020-10-25 18:53 ` [PATCH 1/2] KVM: selftests: Add get featured msrs test case Peter Xu
2020-10-26 8:58 ` Vitaly Kuznetsov
2020-10-26 9:08 ` Andrew Jones
2020-10-31 15:34 ` Peter Xu
2020-10-25 18:53 ` Peter Xu [this message]
2020-10-26 9:07 ` [PATCH 2/2] KVM: X86: Fix null pointer reference for KVM_GET_MSRS Vitaly Kuznetsov
2020-10-31 14:06 ` Paolo Bonzini
2020-10-31 15:27 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201025185334.389061-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=kernel-bugs@steffen.cc \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox