From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Peter Xu <peterx@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: peterx@redhat.com,
Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Steffen Dirkwinkel <kernel-bugs@steffen.cc>
Subject: Re: [PATCH 2/2] KVM: X86: Fix null pointer reference for KVM_GET_MSRS
Date: Mon, 26 Oct 2020 10:07:27 +0100 [thread overview]
Message-ID: <871rhl2w4w.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20201025185334.389061-3-peterx@redhat.com>
Peter Xu <peterx@redhat.com> writes:
> kvm_msr_ignored_check() could trigger a null pointer reference
'dereference' but I'd also clarify that 'vcpu' is NULL.
> 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
Fixes: 12bc2132b15e ("KVM: X86: Do the same ignore_msrs check for feature msrs")
please (checkpatch.pl should've complained I guess)
> 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);
I would've preserved vcpu version for non-gloal cases, e.g.
if (report_ignored_msrs) {
if (vcpu)
vcpu_unimpl(vcpu, "ignored %s: 0x%x data 0x%llx\n",
op, msr, data);
else
kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n",
op, msr, data);
}
> /* Mask the error */
> return 0;
> } else {
--
Vitaly
next prev parent reply other threads:[~2020-10-26 9:07 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 ` [PATCH 2/2] KVM: X86: Fix null pointer reference for KVM_GET_MSRS Peter Xu
2020-10-26 9:07 ` Vitaly Kuznetsov [this message]
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=871rhl2w4w.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=kernel-bugs@steffen.cc \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=sean.j.christopherson@intel.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