From: Yu Zhang <yu.c.zhang@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Jim Mattson <jmattson@google.com>
Cc: "kvm list" <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>,
xiaoguangrong@tencent.com, "Joerg Roedel" <joro@8bytes.org>
Subject: Re: [PATCH v3 2/5] KVM: MMU: check guest CR3 reserved bits based on its physical address width.
Date: Mon, 18 Sep 2017 17:35:19 +0800 [thread overview]
Message-ID: <bbd7ee7b-cc7b-ade3-f3a7-44fd9801ded2@linux.intel.com> (raw)
In-Reply-To: <6b811eb0-1204-08b1-61c2-0030fa450ad4@redhat.com>
On 9/18/2017 4:41 PM, Paolo Bonzini wrote:
> On 18/09/2017 10:15, Yu Zhang wrote:
>>> static bool emulator_get_cpuid(struct x86_emulate_ctxt *ctxt,
>>> u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, bool
>>> check_limit)
>>> {
>>> return kvm_cpuid(emul_to_vcpu(ctxt), eax, ebx, ecx, edx,
>>> check_limit);
>>> }
>>>
>>> And:
>>>
>>> bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,
>>> u32 *ecx, u32 *edx, bool check_limit)
>>> {
>>> u32 function = *eax, index = *ecx;
>>> struct kvm_cpuid_entry2 *best;
>>> bool entry_found = true;
>>> ...
>>>
>>> Doesn't this immediately try to dereference a NULL pointer? How much
>>> testing have you done of this code?
>> Thanks Jim.
>> I have tested this code in a simulator to successfully boot a VM in
>> shadow mode. Seems this code is not covered(but I am now still
>> perplexed why this is not covered). Any possibility that the
>> check_cr_write() is not triggered when emulating the cr operations?
> CR moves usually don't go through the emulator (the main exception is
> emulation of invalid guest state when the processor doesn't support
> unrestricted_guest=1, but even that is unlikely to happen with
> EFER.LMA=1). This explains why you didn't see the failure.
Oh, right. It normally goes to handle_cr(). Thanks, Paolo.
Yu
>
>> Anyway, this should be a bug and thanks for pointing this out, and
>> I'll send out the fix later.
> Thanks,
>
> Paolo
>
next prev parent reply other threads:[~2017-09-18 9:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 12:27 [PATCH v3 0/5] KVM: MMU: 5 level EPT/shadow support Yu Zhang
2017-08-24 12:27 ` [PATCH v3 1/5] KVM: x86: Add return value to kvm_cpuid() Yu Zhang
2017-08-24 12:27 ` [PATCH v3 2/5] KVM: MMU: check guest CR3 reserved bits based on its physical address width Yu Zhang
2017-08-24 13:40 ` Paolo Bonzini
2017-08-24 15:23 ` Yu Zhang
2017-08-24 15:50 ` Paolo Bonzini
2017-08-24 15:38 ` Yu Zhang
2017-08-24 16:27 ` Paolo Bonzini
2017-08-24 16:21 ` Yu Zhang
2017-08-24 16:51 ` Paolo Bonzini
2017-09-15 23:19 ` Jim Mattson
2017-09-18 8:15 ` Yu Zhang
2017-09-18 8:41 ` Paolo Bonzini
2017-09-18 9:35 ` Yu Zhang [this message]
2017-08-24 12:27 ` [PATCH v3 3/5] KVM: MMU: Rename PT64_ROOT_LEVEL to PT64_ROOT_4LEVEL Yu Zhang
2017-08-24 12:27 ` [PATCH v3 4/5] KVM: MMU: Add 5 level EPT & Shadow page table support Yu Zhang
2017-08-24 13:42 ` Paolo Bonzini
2017-08-24 12:27 ` [PATCH v3 5/5] KVM: MMU: Expose the LA57 feature to VM Yu Zhang
2017-08-24 13:47 ` [PATCH v3 0/5] KVM: MMU: 5 level EPT/shadow support Paolo Bonzini
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=bbd7ee7b-cc7b-ade3-f3a7-44fd9801ded2@linux.intel.com \
--to=yu.c.zhang@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=xiaoguangrong@tencent.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