xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxc: restore: bounds check for start_info.{store_mfn, console.domU.mfn}
@ 2012-07-20 14:13 Ian Campbell
  2012-07-20 16:06 ` Ian Jackson
  0 siblings, 1 reply; 7+ messages in thread
From: Ian Campbell @ 2012-07-20 14:13 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, Jonathan Ludlam

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# 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@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-23 12:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-20 14:13 [PATCH] libxc: restore: bounds check for start_info.{store_mfn, console.domU.mfn} Ian Campbell
2012-07-20 16:06 ` Ian Jackson
2012-07-20 16:30   ` Ian Campbell
2012-07-20 17:00     ` Daniel De Graaf
2012-07-23 11:03       ` Ian Campbell
2012-07-23 11:06       ` Ian Jackson
2012-07-23 12:15         ` Ian Campbell

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).