* [PULL 0/2] xen-20160614-tag @ 2016-06-14 15:04 Stefano Stabellini 2016-06-14 15:05 ` [PULL 1/2] xen/blkif: avoid double access to any shared ring request fields Stefano Stabellini 2016-06-14 16:10 ` [PULL 0/2] xen-20160614-tag Peter Maydell 0 siblings, 2 replies; 4+ messages in thread From: Stefano Stabellini @ 2016-06-14 15:04 UTC (permalink / raw) To: peter.maydell; +Cc: anthony.perard, sstabellini, qemu-devel, xen-devel The following changes since commit 55e5c3a2d2433bd2e1e635a7ba395f1c70341794: Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-2016-06-13-v1' into staging (2016-06-13 13:05:02 +0100) are available in the git repository at: git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/xen-20160614-tag for you to fetch changes up to b1b23e5bbfb66d9401e2c2b0646fb721d94a3f83: xen: Clean up includes (2016-06-14 15:37:43 +0100) ---------------------------------------------------------------- Xen 2016/06/14 ---------------------------------------------------------------- Jan Beulich (1): xen/blkif: avoid double access to any shared ring request fields Peter Maydell (1): xen: Clean up includes hw/block/xen_blkif.h | 12 ++++++------ hw/block/xen_disk.c | 2 ++ hw/usb/xen-usb.c | 5 +---- include/hw/xen/xen.h | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/2] xen/blkif: avoid double access to any shared ring request fields 2016-06-14 15:04 [PULL 0/2] xen-20160614-tag Stefano Stabellini @ 2016-06-14 15:05 ` Stefano Stabellini 2016-06-14 15:05 ` [PULL 2/2] xen: Clean up includes Stefano Stabellini 2016-06-14 16:10 ` [PULL 0/2] xen-20160614-tag Peter Maydell 1 sibling, 1 reply; 4+ messages in thread From: Stefano Stabellini @ 2016-06-14 15:05 UTC (permalink / raw) To: peter.maydell Cc: anthony.perard, sstabellini, qemu-devel, Jan Beulich, xen-devel From: Jan Beulich <JBeulich@suse.com> Commit f9e98e5d7a ("xen/blkif: Avoid double access to src->nr_segments") didn't go far enough: src->operation is also being used twice. And nothing was done to prevent the compiler from using the source side of the copy done by blk_get_request() (granted that's very unlikely). Move the barrier()s up, and add another one to blk_get_request(). Note that for completing XSA-155, the barrier() getting added to blk_get_request() would suffice, and hence the changes to xen_blkif.h are more like just cleanup. And since, as said, the unpatched code getting compiled to something vulnerable is very unlikely (and not observed in practice), this isn't being viewed as a new security issue. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org> --- hw/block/xen_blkif.h | 12 ++++++------ hw/block/xen_disk.c | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/block/xen_blkif.h b/hw/block/xen_blkif.h index c68487cb..e3b133b 100644 --- a/hw/block/xen_blkif.h +++ b/hw/block/xen_blkif.h @@ -79,14 +79,14 @@ static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (src->operation == BLKIF_OP_DISCARD) { + /* Prevent the compiler from using src->... instead. */ + barrier(); + if (dst->operation == BLKIF_OP_DISCARD) { struct blkif_request_discard *s = (void *)src; struct blkif_request_discard *d = (void *)dst; d->nr_sectors = s->nr_sectors; return; } - /* prevent the compiler from optimizing the code and using src->nr_segments instead */ - barrier(); if (n > dst->nr_segments) n = dst->nr_segments; for (i = 0; i < n; i++) @@ -102,14 +102,14 @@ static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_reque dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (src->operation == BLKIF_OP_DISCARD) { + /* Prevent the compiler from using src->... instead. */ + barrier(); + if (dst->operation == BLKIF_OP_DISCARD) { struct blkif_request_discard *s = (void *)src; struct blkif_request_discard *d = (void *)dst; d->nr_sectors = s->nr_sectors; return; } - /* prevent the compiler from optimizing the code and using src->nr_segments instead */ - barrier(); if (n > dst->nr_segments) n = dst->nr_segments; for (i = 0; i < n; i++) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 064c116..cf57814 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -679,6 +679,8 @@ static int blk_get_request(struct XenBlkDev *blkdev, struct ioreq *ioreq, RING_I RING_GET_REQUEST(&blkdev->rings.x86_64_part, rc)); break; } + /* Prevent the compiler from accessing the on-ring fields instead. */ + barrier(); return 0; } -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PULL 2/2] xen: Clean up includes 2016-06-14 15:05 ` [PULL 1/2] xen/blkif: avoid double access to any shared ring request fields Stefano Stabellini @ 2016-06-14 15:05 ` Stefano Stabellini 0 siblings, 0 replies; 4+ messages in thread From: Stefano Stabellini @ 2016-06-14 15:05 UTC (permalink / raw) To: peter.maydell; +Cc: anthony.perard, sstabellini, qemu-devel, xen-devel From: Peter Maydell <peter.maydell@linaro.org> Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org> --- hw/usb/xen-usb.c | 5 +---- include/hw/xen/xen.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 664df04..8fa47ed 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -19,13 +19,10 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include <libusb.h> -#include <stdio.h> -#include <sys/types.h> #include <sys/mman.h> -#include <sys/time.h> -#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/config-file.h" #include "hw/sysbus.h" diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 6365483..b2cd992 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -8,7 +8,6 @@ */ #include "qemu-common.h" -#include "qemu/typedefs.h" #include "exec/cpu-common.h" #include "hw/irq.h" -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/2] xen-20160614-tag 2016-06-14 15:04 [PULL 0/2] xen-20160614-tag Stefano Stabellini 2016-06-14 15:05 ` [PULL 1/2] xen/blkif: avoid double access to any shared ring request fields Stefano Stabellini @ 2016-06-14 16:10 ` Peter Maydell 1 sibling, 0 replies; 4+ messages in thread From: Peter Maydell @ 2016-06-14 16:10 UTC (permalink / raw) To: Stefano Stabellini; +Cc: Anthony PERARD, QEMU Developers, xen-devel On 14 June 2016 at 16:04, Stefano Stabellini <sstabellini@kernel.org> wrote: > The following changes since commit 55e5c3a2d2433bd2e1e635a7ba395f1c70341794: > > Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-2016-06-13-v1' into staging (2016-06-13 13:05:02 +0100) > > are available in the git repository at: > > > git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/xen-20160614-tag > > for you to fetch changes up to b1b23e5bbfb66d9401e2c2b0646fb721d94a3f83: > > xen: Clean up includes (2016-06-14 15:37:43 +0100) > > ---------------------------------------------------------------- > Xen 2016/06/14 > > ---------------------------------------------------------------- > Jan Beulich (1): > xen/blkif: avoid double access to any shared ring request fields > > Peter Maydell (1): > xen: Clean up includes > > hw/block/xen_blkif.h | 12 ++++++------ > hw/block/xen_disk.c | 2 ++ > hw/usb/xen-usb.c | 5 +---- > include/hw/xen/xen.h | 1 - > 4 files changed, 9 insertions(+), 11 deletions(-) Applied, thanks. -- PMM _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-14 16:10 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-14 15:04 [PULL 0/2] xen-20160614-tag Stefano Stabellini 2016-06-14 15:05 ` [PULL 1/2] xen/blkif: avoid double access to any shared ring request fields Stefano Stabellini 2016-06-14 15:05 ` [PULL 2/2] xen: Clean up includes Stefano Stabellini 2016-06-14 16:10 ` [PULL 0/2] xen-20160614-tag Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).