Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751335AbdIPRsP (ORCPT ); Sat, 16 Sep 2017 13:48:15 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:5214 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbdIPRsO (ORCPT ); Sat, 16 Sep 2017 13:48:14 -0400 X-IronPort-AV: E=Sophos;i="5.42,403,1500940800"; d="scan'208";a="693662802" Subject: Re: [mainline][bisected 36ae3c0] Build fail at virt/kvm/eventfd.c:568 To: Abdul Haleem , linuxppc-dev , Paolo Bonzini References: <1505579069.9665.22.camel@abdul.in.ibm.com> Cc: mpe , linux-kernel , sachinp From: "=?UTF-8?Q?Jan_H._Sch=c3=b6nherr?=" Message-ID: <04cde7c8-d41f-96e2-2b4b-2287b8f04bfc@amazon.de> Date: Sat, 16 Sep 2017 19:46:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1505579069.9665.22.camel@abdul.in.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2150 Lines: 58 On 09/16/2017 06:24 PM, Abdul Haleem wrote: > Hi, > > Today's mainline kernel failed to build on powerpc with below error > > arch/powerpc/kvm/../../../virt/kvm/eventfd.c: In function ‘kvm_irqfd’: > arch/powerpc/kvm/../../../virt/kvm/eventfd.c:568:19: error: > ‘KVM_MAX_IRQ_ROUTES’ undeclared (first use in this function) > if (args->gsi >= KVM_MAX_IRQ_ROUTES) Hmm... the header file for that constant is included... ... but it's only defined when CONFIG_HAVE_KVM_IRQ_ROUTING, which is not the case here. We can either make that "if" conditional on that, or we revert the commit. The commit was meant the give user space an early indication that something is wrong. I was only aware of the IRQ routing use case. This indicates that there are other use cases. To err on the side of caution, I'd favor a revert as the patch is not strictly needed -- unless someone else can provide more insight on valid values for GSI. Paolo, do you want me to prepare a revert for the commit below? Regards Jan > Possible bad commit is : > > commit 36ae3c0a36b7456432fedce38ae2f7bd3e01a563 > Author: Jan H. Schönherr > Date: Thu Sep 7 19:02:48 2017 +0100 > > KVM: Don't accept obviously wrong gsi values via KVM_IRQFD > > We cannot add routes for gsi values >= KVM_MAX_IRQ_ROUTES -- see > kvm_set_irq_routing(). Hence, there is no sense in accepting them > via KVM_IRQFD. Prevent them from entering the system in the first > place. > > Signed-off-by: Jan H. Schönherr > Signed-off-by: Paolo Bonzini > > diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c > index f2ac53a..c608ab4 100644 > --- a/virt/kvm/eventfd.c > +++ b/virt/kvm/eventfd.c > @@ -565,6 +565,8 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) > { > if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | > KVM_IRQFD_FLAG_RESAMPLE)) > return -EINVAL; > + if (args->gsi >= KVM_MAX_IRQ_ROUTES) > + return -EINVAL; > > if (args->flags & KVM_IRQFD_FLAG_DEASSIGN) > return kvm_irqfd_deassign(kvm, args); > >