linux/arch/riscv/kvm
Björn Töpel b1af648f0d riscv: kvm: Fix out-of-bounds array access
[ Upstream commit 332fa4a802 ]

In kvm_riscv_vcpu_sbi_init() the entry->ext_idx can contain an
out-of-bound index. This is used as a special marker for the base
extensions, that cannot be disabled. However, when traversing the
extensions, that special marker is not checked prior indexing the
array.

Add an out-of-bounds check to the function.

Fixes: 56d8a385b6 ("RISC-V: KVM: Allow some SBI extensions to be disabled by default")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20241104191503.74725-1-bjorn@kernel.org
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-12-05 14:02:08 +01:00
..
aia.c RISC-V: KVM: Use IMSIC guest files when available 2024-06-26 18:37:34 +05:30
aia_aplic.c RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation 2024-12-05 14:02:08 +01:00
aia_device.c RISC-V: KVM: Share APLIC and IMSIC defines with irqchip drivers 2024-06-26 18:37:32 +05:30
aia_imsic.c RISCV: KVM: use raw_spinlock for critical section in imsic 2024-10-20 12:10:44 -04:00
Kconfig kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol 2024-02-08 08:41:06 -05:00
main.c KVM: Rename arch hooks related to per-CPU virtualization enabling 2024-09-04 11:02:33 -04:00
Makefile kbuild: use $(src) instead of $(srctree)/$(src) for source directory 2024-05-10 04:34:52 +09:00
mmu.c KVM: delete .change_pte MMU notifier callback 2024-04-11 13:18:27 -04:00
tlb.c riscv: Rearrange hwcap.h and cpufeature.h 2023-11-09 10:15:51 -08:00
trace.h RISCV: KVM: add tracepoints for entry and exit events 2024-06-26 18:37:36 +05:30
vcpu.c ARM: 2024-07-20 12:41:03 -07:00
vcpu_exit.c RISC-V: KVM: Redirect AMO load/store access fault traps to guest 2024-06-26 18:37:41 +05:30
vcpu_fp.c riscv: Rearrange hwcap.h and cpufeature.h 2023-11-09 10:15:51 -08:00
vcpu_insn.c KVM: riscv: Support guest wrs.nto 2024-07-12 08:54:51 -07:00
vcpu_onereg.c RISC-V Patches for the 6.11 Merge Window, Part 1 2024-07-20 09:11:27 -07:00
vcpu_pmu.c RISC-V: KVM: Don't zero-out PMU snapshot area before freeing data 2024-08-19 08:58:17 +05:30
vcpu_sbi.c riscv: kvm: Fix out-of-bounds array access 2024-12-05 14:02:08 +01:00
vcpu_sbi_base.c RISC-V: KVM: Add ONE_REG interface to enable/disable SBI extensions 2023-04-21 17:38:44 +05:30
vcpu_sbi_hsm.c RISCV: KVM: Introduce vcpu->reset_cntx_lock 2024-04-22 10:39:03 +05:30
vcpu_sbi_pmu.c RISC-V: KVM: Improve firmware counter read function 2024-04-26 13:13:54 +05:30
vcpu_sbi_replace.c RISC-V: KVM: Make SBI uapi consistent with ISA uapi 2023-12-29 12:31:44 +05:30
vcpu_sbi_sta.c RISC-V: KVM: Rename the SBI_STA_SHMEM_DISABLE to a generic name 2024-04-22 11:13:52 +05:30
vcpu_sbi_v01.c RISC-V: KVM: Modify SBI extension handler to return SBI error code 2023-02-07 20:35:45 +05:30
vcpu_switch.S riscv: kvm: use ".L" local labels in assembly when applicable 2023-12-29 12:31:33 +05:30
vcpu_timer.c RISC-V: KVM: do not EOPNOTSUPP in set KVM_REG_RISCV_TIMER_REG 2023-08-08 17:25:49 +05:30
vcpu_vector.c RISC-V: KVM: add 'vlenb' Vector CSR 2023-12-29 12:31:54 +05:30
vm.c RISC-V: KVM: Implement kvm_arch_vcpu_ioctl_set_guest_debug() 2024-04-08 14:06:27 +05:30
vmid.c RISC-V: KVM: Drop the _MASK suffix from hgatp.VMID mask defines 2023-04-21 17:45:44 +05:30