From: Ian Campbell Subject: Re: [PATCH 2/4] arm: add bounds check on hypercall array Date: Wed, 25 Jul 2012 16:21:54 +0100 Message-ID: <1343229714.18971.116.camel@zakaz.uk.xensource.com> References: <1343224660.18971.97.camel@zakaz.uk.xensource.com> <1343227442-2781-2-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "Tim (Xen.org)" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2012-07-25 at 16:16 +0100, Stefano Stabellini wrote: > On Wed, 25 Jul 2012, Ian Campbell wrote: > > Otherwise a guest can cause us to run off the end of the array. > > > > Signed-off-by: Ian Campbell > > --- > > xen/arch/arm/traps.c | 6 ++++++ > > 1 files changed, 6 insertions(+), 0 deletions(-) > > > > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c > > index f2c25b5..6201d38 100644 > > --- a/xen/arch/arm/traps.c > > +++ b/xen/arch/arm/traps.c > > @@ -479,6 +479,12 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, unsigned long iss) > > return; > > } > > > > + if ( regs->r12 > ARRAY_SIZE(arm_hypercall_table) ) > > + { > > + regs->r0 = -ENOSYS; > > + return; > > + } > > shouldn't this be >=? Er, yes, I suspect so. Rather than repost how about you ack with the proviso that I fix it as I commit? > > > call = arm_hypercall_table[regs->r12].fn; > > if ( call == NULL ) > > { > > -- > > 1.7.9.1 > >