From: Ian Campbell Subject: Re: [PATCH] arm: implement hypercall continuations Date: Fri, 20 Jul 2012 14:40:48 +0100 Message-ID: <1342791648.26734.115.camel@zakaz.uk.xensource.com> References: <1342690554-30561-1-git-send-email-ian.campbell@citrix.com> <1342790623.26734.111.camel@zakaz.uk.xensource.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: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Fri, 2012-07-20 at 14:28 +0100, Stefano Stabellini wrote: > On Fri, 20 Jul 2012, Ian Campbell wrote: > > > > + for ( i = 0; *p != '\0'; i++ ) > > > > + { > > > > + arg = next_arg(p, args); > > > > + > > > > + switch ( i ) > > > > + { > > > > + case 0: regs->r0 = arg; break; > > > > > > wrong alignment > > > > I had rc = arg and lined it up then chaned it back without realigning, > > thanks for pointing it out. > > > > > > @@ -462,17 +469,18 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code) > > > > > > > > static void do_trap_hypercall(struct cpu_user_regs *regs, unsigned long iss) > > > > { > > > > - arm_hypercall_t *call = NULL; > > > > + arm_hypercall_fn_t call = NULL; > > > > > > > > if ( iss != XEN_HYPERCALL_TAG ) > > > > + domain_crash_synchronous(); > > > > > > Why did you change the behavior of the iss != XEN_HYPERCALL_TAG case? > > > > I just noticed it while adding the bounds check. A guest which makes a > > hypercall with the wrong tag is either malicious or about to fail > > horribly, there's no reason to allow them to keep living. > > I don't think so: it could just be a misconfigured guest, trying to > initialize KVM support before Xen. Or it could be some other guest doing something else entirely, which we've never heard of and with a different semantics for ENOSYS type return values etc. It is clearly bogus for a guest to be making a KVM hypercall on Xen (and vice versa). We should provide a reliable way to detect the exact hypervisor and enforce its use. Ian.