]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen: Add RING_COPY_REQUEST()
authorDavid Vrabel <david.vrabel@citrix.com>
Fri, 30 Oct 2015 14:58:08 +0000 (14:58 +0000)
committerJoao Martins <joao.m.martins@oracle.com>
Sun, 27 Mar 2016 01:01:32 +0000 (02:01 +0100)
commitb9830ead782767b678da952629a2cb0e151c299c
treed37efe7ba9625e8d5aa70df756ab7cf1e8178da5
parent6ddfae05155b22f7b4cb9a0d249060a439dc8fc8
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>
(cherry picked from commit 454d5d882c7e412b840e3c99010fe81a9862f6fb)
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
include/xen/interface/io/ring.h