# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 299f048c4855014f7a3514e58f24768974f44e85
# Parent 90329e7d6be5a30ebe7c63453428a13ed0c97c01
[IA64] Strengthen dom0_getmemlist
reset num_pfns before hypercalling, more checks in hypercall, cleanup
Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
---
tools/libxc/xc_ia64_stubs.c | 4 +++-
xen/arch/ia64/xen/dom0_ops.c | 8 +++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff -r 90329e7d6be5 -r 299f048c4855 tools/libxc/xc_ia64_stubs.c
--- a/tools/libxc/xc_ia64_stubs.c Mon May 15 10:53:23 2006 -0600
+++ b/tools/libxc/xc_ia64_stubs.c Mon May 15 13:42:18 2006 -0600
@@ -50,7 +50,7 @@ xc_plan9_build(int xc_handle,
}
/*
VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
- VMM don't handle this now.
+ VMM doesn't handle this now.
This method will touch guest buffer to make sure the buffer's mapping
is tracked by VMM,
*/
@@ -66,6 +66,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
unsigned int __start_page, __nr_pages;
unsigned long max_pfns;
unsigned long *__pfn_buf;
+
__start_page = start_page;
__nr_pages = nr_pages;
__pfn_buf = pfn_buf;
@@ -75,6 +76,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
op.cmd = DOM0_GETMEMLIST;
op.u.getmemlist.domain = (domid_t)domid;
op.u.getmemlist.max_pfns = max_pfns;
+ op.u.getmemlist.num_pfns = 0;
set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
if ( (max_pfns != -1UL)
diff -r 90329e7d6be5 -r 299f048c4855 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c Mon May 15 10:53:23 2006 -0600
+++ b/xen/arch/ia64/xen/dom0_ops.c Mon May 15 13:42:18 2006 -0600
@@ -151,10 +151,7 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
put_domain(d);
}
break;
- /*
- * NOTE: DOM0_GETMEMLIST has somewhat different semantics on IA64 -
- * it actually allocates and maps pages.
- */
+
case DOM0_GETMEMLIST:
{
unsigned long i = 0;
@@ -198,7 +195,8 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
ret = -ENOMEM;
op->u.getmemlist.num_pfns = i - start_page;
- copy_to_guest(u_dom0_op, op, 1);
+ if (copy_to_guest(u_dom0_op, op, 1))
+ ret = -EFAULT;
put_domain(d);
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|