]> xenbits.xensource.com Git - xen.git/commitdiff
tools/ocaml: oxenstored: correctly handle a full ring.
authorIan Campbell <ian.campbell@citrix.com>
Fri, 15 Feb 2013 11:50:45 +0000 (11:50 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 15 Feb 2013 11:50:45 +0000 (11:50 +0000)
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 <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen-unstable changeset: 26539:759574df84a6
Backport-requested-by: security@xen.org
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/ocaml/libs/xb/xs_ring_stubs.c

index 22e416e85fb40320404a197d4437618ad33f3c08..37649df5bf68ef0f36d6a46b52851e0bbff1de07 100644 (file)
@@ -49,10 +49,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