Re: [PATCH v2 0/4] KVM: x86: Fix off-by-one in max_vcpu_ids bounds checks
From: Sean Christopherson
Date: Fri Nov 13 2026 - 09:03:30 EST
On Fri, 31 Jul 2026 15:08:41 +0000, Dmytro Maluka wrote:
> max_vcpu_ids and KVM_CAP_MAX_VCPU_ID are exclusive, i.e. the maximum
> allowed vcpu_id value is max_vcpu_ids minus one, not max_vcpu_ids.
>
> Fix the sanity checks for KVM_SET_BOOT_CPU_ID and KVM_CAP_MAX_VCPU_ID
> and the selftests for them (added in series [1]) to fail when
> bsp_vcpu_id is incorrectly set to max_vcpu_ids, not to a value below
> max_vcpu_ids.
>
> [...]
Applied to kvm-x86 misc, thanks!
[1/4] KVM: selftests: Fix treating KVM_CAP_MAX_VCPU_ID as inclusive
https://github.com/kvm-x86/linux/commit/9b04ebe5c085
[2/4] KVM: x86: Fix off-by-one in max_vcpu_ids bounds checks
https://github.com/kvm-x86/linux/commit/c36d436e7335
[3/4] KVM: selftests: Improve bsp_vcpu_id and max_vcpu_ids out-of-bound tests
https://github.com/kvm-x86/linux/commit/201aaeb1df8f
[4/4] Documentation: KVM: Clarify that KVM_CAP_MAX_VCPU_ID is exclusive
https://github.com/kvm-x86/linux/commit/ea6d489ae6c2
--
https://github.com/kvm-x86/linux/tree/next