From: Ian Jackson Subject: Re: [PATCH v7 00/22] XSA55 libelf fixes for unstable Date: Wed, 12 Jun 2013 14:45:58 +0100 Message-ID: <20920.31638.988504.813293@mariner.uk.xensource.com> References: <1370974865-19554-1-git-send-email-ian.jackson@eu.citrix.com> <51B77ABA.20304@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51B77ABA.20304@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: "xen-devel@lists.xensource.com" , "mattjd@gmail.com" , "security@xen.org" List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("Re: [PATCH v7 00/22] XSA55 libelf fixes for unstable"): > On 11/06/13 19:20, Ian Jackson wrote: > > This is version 7 of my series to try to fix libelf and the domain > > loader. > > Fantastic. This entire series is now > > Reviewed-by: Andrew Cooper Great, thanks. The 4.1 backports are a work in progress. I have had a review from Oracle by private email. Prompted by that review I did a search and now I'm suspicious of a range test in xc_dom_alloc_segment. I'm considering adding the patch below to the end of my series. Ian. Subject: libxc: Better range check in xc_dom_alloc_segment If seg->pfn is too large, the arithmetic in the range check might overflow, defeating the range check. This is part of the fix to a security issue, XSA-55. Signed-off-by: Ian Jackson diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c index bf05d2a..9c0a52c 100644 --- a/tools/libxc/xc_dom_core.c +++ b/tools/libxc/xc_dom_core.c @@ -510,7 +510,8 @@ int xc_dom_alloc_segment(struct xc_dom_image *dom, seg->vstart = start; seg->pfn = (seg->vstart - dom->parms.virt_base) / page_size; - if ( pages > dom->total_pages || /* double test avoids overflow probs */ + if ( pages > dom->total_pages || /* multiple test avoids overflow probs */ + seg->pfn > dom->total_pages || pages > dom->total_pages - seg->pfn) { xc_dom_panic(dom->xch, XC_OUT_OF_MEMORY,