From: Ian Campbell Subject: Re: [PATCH] tools/ocaml: oxenstored: correctly handle a full ring. Date: Fri, 15 Feb 2013 08:41:09 +0000 Message-ID: <1360917669.25448.6.camel@zakaz.uk.xensource.com> References: <1360748602-9357-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1360748602-9357-1-git-send-email-ian.campbell@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: "xen-devel@lists.xen.org" Cc: Tim Deegan , Ian Jackson , Jon Ludlam List-Id: xen-devel@lists.xenproject.org Can I get an ACK or NACK for this please, we really should update XSA-38 ASAP... On Wed, 2013-02-13 at 09:43 +0000, Ian Campbell wrote: > Change 26521:2c0fd406f02c (part of XSA-38 / CVE-2013-0215) incorrectly > caused us to ignore rather than process a completely full ring. Check if > producer and consumer are equal before masking to avoid this, since prod == > cons + PAGE_SIZE after masking becomes prod == cons. > > Signed-off-by: Ian Campbell > --- > tools/ocaml/libs/xb/xs_ring_stubs.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c > index 4888ac5..fdd9983 100644 > --- a/tools/ocaml/libs/xb/xs_ring_stubs.c > +++ b/tools/ocaml/libs/xb/xs_ring_stubs.c > @@ -45,10 +45,10 @@ static int xs_ring_read(struct mmap_interface *interface, > cons = *(volatile uint32*)&intf->req_cons; > prod = *(volatile uint32*)&intf->req_prod; > xen_mb(); > - cons = MASK_XENSTORE_IDX(cons); > - prod = MASK_XENSTORE_IDX(prod); > if (prod == cons) > return 0; > + cons = MASK_XENSTORE_IDX(cons); > + prod = MASK_XENSTORE_IDX(prod); > if (prod > cons) > to_read = prod - cons; > else