From: Ian Campbell Date: Mon, 23 Jul 2012 12:09:38 +0000 (+0100) Subject: libxc: restore: bounds check for start_info.{store_mfn,console.domU.mfn} X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8177 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c8c7017f064d03623c02a61fa35be6720591be90;p=xen.git 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 Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Campbell --- diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index 6227d43ffd..3fe2b12373 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -1912,9 +1912,21 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, SET_FIELD(start_info, nr_pages, dinfo->p2m_size); SET_FIELD(start_info, shared_info, shared_info_frame< 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);