From: Roman Kagan Subject: Re: [PATCH v4 1/5] KVM: x86: hyperv: enforce vp_index < KVM_MAX_VCPUS Date: Mon, 9 Jul 2018 20:56:21 +0300 Message-ID: <20180709175620.GA3017@rkaganb.sw.ru> References: <20180703134206.27240-1-vkuznets@redhat.com> <20180703134206.27240-2-vkuznets@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Wanpeng Li , linux-kernel@vger.kernel.org To: Vitaly Kuznetsov Return-path: Content-Disposition: inline In-Reply-To: <20180703134206.27240-2-vkuznets@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Tue, Jul 03, 2018 at 03:42:02PM +0200, Vitaly Kuznetsov wrote: > Hyper-V TLFS (5.0b) states: > > > Virtual processors are identified by using an index (VP index). The > > maximum number of virtual processors per partition supported by the > > current implementation of the hypervisor can be obtained through CPUID > > leaf 0x40000005. A virtual processor index must be less than the > > maximum number of virtual processors per partition. > > Forbid userspace to set VP_INDEX above KVM_MAX_VCPUS. get_vcpu_by_vpidx() > can now be optimized to bail early when supplied vpidx is >= KVM_MAX_VCPUS. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) Reviewed-by: Roman Kagan