xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tim Deegan <tim@xen.org>, Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2/4] arm: add bounds check on hypercall array
Date: Wed, 25 Jul 2012 14:43:59 +0000	[thread overview]
Message-ID: <1343227442-2781-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1343224660.18971.97.camel@zakaz.uk.xensource.com>

Otherwise a guest can cause us to run off the end of the array.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 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;
+    }
+
     call = arm_hypercall_table[regs->r12].fn;
     if ( call == NULL )
     {
-- 
1.7.9.1

  parent reply	other threads:[~2012-07-25 14:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 13:57 [PATCH 0/4] arm: hypercall handling improvements Ian Campbell
2012-07-25 14:43 ` [PATCH 1/4] arm: clobber only argument registers Ian Campbell
2012-07-25 15:15   ` Stefano Stabellini
2012-07-25 14:43 ` Ian Campbell [this message]
2012-07-25 15:16   ` [PATCH 2/4] arm: add bounds check on hypercall array Stefano Stabellini
2012-07-25 15:21     ` Ian Campbell
2012-07-25 15:40       ` Stefano Stabellini
2012-07-25 14:44 ` [PATCH 3/4] arm: implement hypercall continuations Ian Campbell
2012-07-25 15:45   ` Stefano Stabellini
2012-07-25 14:44 ` [PATCH 4/4] arm: kill a guest which uses hvc with an immediate operand != XEN_HYPERCALL_TAG Ian Campbell
2012-07-25 16:42 ` [PATCH 0/4] arm: hypercall handling improvements Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343227442-2781-2-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).