[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] i386/kvm: mask MSR_IA32_BNDCFGS if MPX is not e
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] i386/kvm: mask MSR_IA32_BNDCFGS if MPX is not enabled in guest cpuid |
Date: |
Mon, 3 Jul 2017 17:45:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
On 03/07/2017 17:23, Haozhong Zhang wrote:
> Otherwise, QEMU on a host with MPX support will try to set guest
> MSR_IA32_BNDCFGS although guest MPX is not enabled, and result in
> abort.
>
> For example,
> qemu-system-x86_64 -enable-kvm -cpu qemu64,-mpx ...
> aborts with messages:
> qemu-system-x86_64: error: failed to set MSR 0xd90 to 0x0
> qemu-system-x86_64: /root/qemu.git/target/i386/kvm.c:1832: kvm_put_msrs:
> Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed
I think the fix should be in KVM, allowing BNDCFGS = 0 if
host_initiated, even if MPX is not enabled.
Paolo
> Signed-off-by: Haozhong Zhang <address@hidden>
> ---
> target/i386/kvm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index ee36502789..7b3a310a31 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -943,6 +943,11 @@ int kvm_arch_init_vcpu(CPUState *cs)
> has_msr_mcg_ext_ctl = has_msr_feature_control = true;
> }
>
> + if (has_msr_bndcfgs) {
> + c = cpuid_find_entry(&cpuid_data.cpuid, 7, 0);
> + has_msr_bndcfgs = c && (c->ebx & CPUID_7_0_EBX_MPX);
> + }
> +
> if (!env->user_tsc_khz) {
> if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> invtsc_mig_blocker == NULL) {
>