]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: use array_index_nospec with indices that come from guest
authorThijs Raymakers <thijs@raymakers.nl>
Mon, 4 Aug 2025 06:44:05 +0000 (08:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 12:05:55 +0000 (14:05 +0200)
commit72777fc31aa7ab2ce00f44bfa3929c6eabbeaf48
tree77b00a8de0c96f88297338e90e7d0031cb3df081
parent0f63fbabeaaaaaaf5b742a2f4c1b4590d50bf1f6
KVM: x86: use array_index_nospec with indices that come from guest

commit c87bd4dd43a624109c3cc42d843138378a7f4548 upstream.

min and dest_id are guest-controlled indices. Using array_index_nospec()
after the bounds checks clamps these values to mitigate speculative execution
side-channels.

Signed-off-by: Thijs Raymakers <thijs@raymakers.nl>
Cc: stable@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 715062970f37 ("KVM: X86: Implement PV sched yield hypercall")
Fixes: bdf7ffc89922 ("KVM: LAPIC: Fix pv ipis out-of-bounds access")
Fixes: 4180bf1b655a ("KVM: X86: Implement "send IPI" hypercall")
Link: https://lore.kernel.org/r/20250804064405.4802-1-thijs@raymakers.nl
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/lapic.c
arch/x86/kvm/x86.c