[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxc: restore: bounds check for start_info.{store_mfn, console.domU.mfn}



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1342793598 -3600
# Node ID 5e8449a87a993cc2d2fb89a6ba0bbdc1df916771
# Parent  79cfa1892a5d55f2c137da6d4f2d5f261b47db26
libxc: restore: bounds check for start_info.{store_mfn,console.domU.mfn}

These fields are canonicalised by the guest on suspend and therefore must be
valid pfns during restore.

Reported-by: Jonathan Ludlam <Jonathan.Ludlam@xxxxxxxxxxxxx>
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 79cfa1892a5d -r 5e8449a87a99 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Fri Jul 20 14:51:05 2012 +0100
+++ b/tools/libxc/xc_domain_restore.c   Fri Jul 20 15:13:18 2012 +0100
@@ -1912,9 +1912,21 @@ int xc_domain_restore(xc_interface *xch,
             SET_FIELD(start_info, nr_pages, dinfo->p2m_size);
             SET_FIELD(start_info, shared_info, shared_info_frame<<PAGE_SHIFT);
             SET_FIELD(start_info, flags, 0);
+            if ( GET_FIELD(start_info, store_mfn) > dinfo->p2m_size )
+            {
+                ERROR("Suspend record xenstore frame number is bad");
+                munmap(start_info, PAGE_SIZE);
+                goto out;
+            }
             *store_mfn = ctx->p2m[GET_FIELD(start_info, store_mfn)];
             SET_FIELD(start_info, store_mfn, *store_mfn);
             SET_FIELD(start_info, store_evtchn, store_evtchn);
+            if ( GET_FIELD(start_info, console.domU.mfn) > dinfo->p2m_size )
+            {
+                ERROR("Suspend record console frame number is bad");
+                munmap(start_info, PAGE_SIZE);
+                goto out;
+            }
             *console_mfn = ctx->p2m[GET_FIELD(start_info, console.domU.mfn)];
             SET_FIELD(start_info, console.domU.mfn, *console_mfn);
             SET_FIELD(start_info, console.domU.evtchn, console_evtchn);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.