mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
KVM: x86: Inject #GP if WRMSR sets reserved bits in APIC Self-IPI
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 <[email protected]> Cc: Ben Gardon <[email protected]> Cc: Venkatesh Srinivas <[email protected]> Cc: [email protected] Reviewed-by: Maxim Levitsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
This commit is contained in:
1 parent
85e64d09f7
commit
ba5838abb0
1 file changed
+7
-3
@@ -2324,10 +2324,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;
|
||||
|
||||
Reference in new issue
Block a user