From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [V7 PATCH 3/7] pvh dom0: implement XENMEM_add_to_physmap_range for x86 Date: Tue, 17 Dec 2013 16:56:55 +0000 Message-ID: <52B09067020000780010E4B5@nat28.tlf.novell.com> References: <1387247911-28846-1-git-send-email-mukesh.rathor@oracle.com> <1387247911-28846-4-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vsxx4-0001t9-DU for xen-devel@lists.xenproject.org; Tue, 17 Dec 2013 16:56:58 +0000 In-Reply-To: <1387247911-28846-4-git-send-email-mukesh.rathor@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: george.dunlap@eu.citrix.com, xen-devel , keir.xen@gmail.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 17.12.13 at 03:38, Mukesh Rathor wrote: > + case XENMEM_add_to_physmap_range: > + { > + struct xen_add_to_physmap_range xatpr; > + struct domain *d; > + > + if ( copy_from_guest(&xatpr, arg, 1) ) > + return -EFAULT; > + > + /* This mapspace is redundant for this hypercall */ > + if ( xatpr.space == XENMAPSPACE_gmfn_range ) > + return -EINVAL; > + > + d = rcu_lock_domain_by_any_id(xatpr.domid); > + if ( d == NULL ) > + return -ESRCH; > + > + if ( (rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d)) == 0 ) > + rc = xenmem_add_to_physmap_range(d, &xatpr); > + > + rcu_unlock_domain(d); > + > + if ( rc == -EAGAIN ) > + rc = hypercall_create_continuation( > + __HYPERVISOR_memory_op, "ih", op, arg); There's another bug here: You don't copy back xatpr, and hence when the hypercall gets resumed, you'll again find the original size rather than the reduced one. Jan > + > + return rc; > + }