]> xenbits.xensource.com Git - xen.git/commit
xen: Add RING_COPY_REQUEST()
authorDavid Vrabel <david.vrabel@citrix.com>
Fri, 20 Nov 2015 16:59:05 +0000 (11:59 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 18 Dec 2015 14:49:07 +0000 (09:49 -0500)
commit3f20b8def0f4c0d912f1ffc1893199b6e8820477
treee25cfbeac2bd5413a74e3f13f65f4f59fc39ae96
parentb452430a4cdfc801fa4bc391aed7522365e1deb6
xen: Add RING_COPY_REQUEST()

Using RING_GET_REQUEST() on a shared ring is easy to use incorrectly
(i.e., by not considering that the other end may alter the data in the
shared ring while it is being inspected).  Safe usage of a request
generally requires taking a local copy.

Provide a RING_COPY_REQUEST() macro to use instead of
RING_GET_REQUEST() and an open-coded memcpy().  This takes care of
ensuring that the copy is done correctly regardless of any possible
compiler optimizations.

Use a volatile source to prevent the compiler from reordering or
omitting the copy.

This is part of XSA155.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/include/public/io/ring.h