On Sat, Aug 29, 2026 at 07:48:55AM +0200, Karl Mehltretter wrote:
> kvm_smccc_set_filter() only rejects a range if its inclusive end,
> base + nr_functions - 1, is below base. That catches an empty range
> (nr_functions == 0) at every nonzero base, but at base 0 the end wraps
> to U32_MAX and KVM tries to insert [0, U32_MAX], which overlaps the
> reserved Arm Architecture Calls ranges. KVM_ARM_VM_SMCCC_FILTER then
> returns -EEXIST instead of the -EINVAL that the smccc_filter selftest
> expects for an empty range.
>
> Reject a zero function count explicitly.
>
> Tested with a userspace reproducer on an arm64 VHE host under QEMU TCG:
> EEXIST before, EINVAL after.
>
> Fixes: 821d935c87bc ("KVM: arm64: Introduce support for userspace SMCCC
> filtering")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <[email protected]>
Good catch.
Reviewed-by: Steffen Eiden <[email protected]>
FWIW: Tested it on my downstream version of arm-on-s390 with hypercalls
already implemented.