[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab0e5d5b7f69416d8e39068bbec930dbeafc979e.camel@redhat.com>
Date: Sun, 08 Jan 2023 18:40:37 +0200
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Marc Orr <marcorr@...gle.com>, Ben Gardon <bgardon@...gle.com>,
Venkatesh Srinivas <venkateshs@...omium.org>
Subject: Re: [PATCH 1/6] KVM: x86: Inject #GP if WRMSR sets reserved bits in
APIC Self-IPI
On Sat, 2023-01-07 at 01:10 +0000, Sean Christopherson wrote:
> Inject a #GP if the guest attempts to set reserved bits in the x2APIC-only
> Self-IPI register. Bits 7:0 hold the vector, all other bits are reserved.
>
> Reported-by: Marc Orr <marcorr@...gle.com>
> Cc: Ben Gardon <bgardon@...gle.com>
> Cc: Venkatesh Srinivas <venkateshs@...omium.org>
> Cc: stable@...r.kernel.org
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> arch/x86/kvm/lapic.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 80f92cbc4029..f77da92c6ea6 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -2315,10 +2315,14 @@ static int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
> break;
>
> case APIC_SELF_IPI:
> - if (apic_x2apic_mode(apic))
> - kvm_apic_send_ipi(apic, APIC_DEST_SELF | (val & APIC_VECTOR_MASK), 0);
> - else
> + /*
> + * Self-IPI exists only when x2APIC is enabled. Bits 7:0 hold
> + * the vector, everything else is reserved.
> + */
> + if (!apic_x2apic_mode(apic) || (val & ~APIC_VECTOR_MASK))
> ret = 1;
> + else
> + kvm_apic_send_ipi(apic, APIC_DEST_SELF | val, 0);
> break;
> default:
> ret = 1;
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists