diff options
| author | Anel Orazgaliyeva <anelkz@amazon.de> | 2026-03-06 08:59:52 +0100 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-03-12 09:11:40 -0700 |
| commit | 00d572d4cd7d23f9a7a498d2d824b68ba3ea5b88 (patch) | |
| tree | c458d00d731f4b3a4034b65e0ba2dec20e9ecaa3 /scripts/stackusage | |
| parent | 26c9bfc0fac240540581cfbe58031b412f98aaf8 (diff) | |
KVM: X86: Fix array_index_nospec protection in __pv_send_ipi
The __pv_send_ipi() function iterates over up to BITS_PER_LONG vCPUs
starting from the APIC ID specified in its 'min' argument, which is
provided by the guest.
Commit c87bd4dd43a6 used array_index_nospec() to clamp the value of 'min'
but then the for_each_set_bit() loop dereferences higher indices without
further protection. Theoretically, a guest can trigger speculative access
to up to BITS_PER_LONG elements off the end of the phys_map[] array.
(In practice it would probably need aggressive loop unrolling by the
compiler to go more than one element off the end, and even that seems
unlikely, but the theoretical possibility exists.)
Move the array_index_nospec() inside the loop to protect the [map + i]
index which is actually being used each time.
Fixes: c87bd4dd43a6 ("KVM: x86: use array_index_nospec with indices that come from guest")
Fixes: bdf7ffc89922 ("KVM: LAPIC: Fix pv ipis out-of-bounds access")
Fixes: 4180bf1b655a ("KVM: X86: Implement "send IPI" hypercall")
Signed-off-by: Anel Orazgaliyeva <anelkz@amazon.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Jim Mattson <jmattson@google.com>
Link: https://patch.msgid.link/9d50fc3ca9e8e58f551d015f95d51a3c29ce6ccc.camel@infradead.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'scripts/stackusage')
0 files changed, 0 insertions, 0 deletions
