[PATCH] arm64: kvm: Fix potential overflow in len
Oliver Upton
oliver.upton at linux.dev
Fri Dec 27 23:09:00 PST 2024
On Sat, Dec 28, 2024 at 02:01:27AM +0000, Steven Davis wrote:
> The MMIO sign-extension logic in kvm_handle_mmio_return can
> trigger an integer overflow or undefined behavior when len
> is invalid (e.g., len == 0 or len exceeds the size of unsigned
> long). Specifically, the expression (len * 8) - 1 may result
> in an out-of-bounds shift in the computation of the mask.
I don't believe we need this. len is known to be nonzero and at most 8,
which is already being tested for in the existing condition. See the
definition of kvm_vcpu_dabt_get_as() if you're curious why that is.
--
Thanks,
Oliver
More information about the linux-arm-kernel
mailing list