]> git.baikalelectronics.ru Git - kernel.git/commit
xen: Add RING_COPY_REQUEST()
authorDavid Vrabel <david.vrabel@citrix.com>
Fri, 30 Oct 2015 14:58:08 +0000 (14:58 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 18 Dec 2015 15:00:17 +0000 (10:00 -0500)
commitdf540b36165e6b10fc6a3653efa54e52a83e7d7e
treed5365a0ffb5807285da7af3834b6a73c8531d9bd
parenta3100d55328e198cf1d50cf48b6c6bd2a5702623
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.

CC: stable@vger.kernel.org
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
include/xen/interface/io/ring.h