head 1.2; access; symbols pkgsrc-2016Q4:1.1.0.2 pkgsrc-2016Q4-base:1.1; locks; strict; comment @# @; 1.2 date 2016.12.29.19.13.03; author wiz; state dead; branches; next 1.1; commitid kFYPk8EnajcmFUzz; 1.1 date 2016.11.22.20.53.40; author bouyer; state Exp; branches; next ; commitid o5sczsI7INv1pavz; desc @@ 1.2 log @Remove xenkernel and tools versions 3, 33, and 41. As discussed on pkgsrc-users. @ text @$NetBSD: patch-XSA-197,v 1.1 2016/11/22 20:53:40 bouyer Exp $ Backported from: From: Jan Beulich Subject: xen: fix ioreq handling Avoid double fetches and bounds check size to avoid overflowing internal variables. This is XSA-197. Reported-by: yanghongke Signed-off-by: Jan Beulich Reviewed-by: Ian Jackson --- ioemu-qemu-xen/i386-dm/helper2.c.orig 2013-07-17 12:59:40.000000000 +0200 +++ ioemu-qemu-xen/i386-dm/helper2.c 2016-11-22 16:15:32.000000000 +0100 @@@@ -333,6 +333,11 @@@@ sign = req->df ? -1 : 1; + if (req->size > sizeof(unsigned long)) { + fprintf(stderr, "PIO: bad size (%u)\n", req->size); + exit(-1); + } + if (req->dir == IOREQ_READ) { if (!req->data_is_ptr) { req->data = do_inp(env, req->addr, req->size); @@@@ -368,6 +373,11 @@@@ sign = req->df ? -1 : 1; + if (req->size > sizeof(req->data)) { + fprintf(stderr, "MMIO: bad size (%u)\n", req->size); + exit(-1); + } + if (!req->data_is_ptr) { if (req->dir == IOREQ_READ) { for (i = 0; i < req->count; i++) { @@@@ -481,11 +491,13 @@@@ req.df = 1; req.type = buf_req->type; req.data_is_ptr = 0; + xen_rmb(); qw = (req.size == 8); if (qw) { buf_req = &buffered_io_page->buf_ioreq[ (buffered_io_page->read_pointer+1) % IOREQ_BUFFER_SLOT_NUM]; req.data |= ((uint64_t)buf_req->data) << 32; + xen_rmb(); } __handle_ioreq(env, &req); @@@@ -512,7 +524,11 @@@@ __handle_buffered_iopage(env); if (req) { - __handle_ioreq(env, req); + ioreq_t copy = *req; + + xen_rmb(); + __handle_ioreq(env, ©); + req->data = copy.data; if (req->state != STATE_IOREQ_INPROCESS) { fprintf(logfile, "Badness in I/O request ... not in service?!: " @ 1.1 log @Backport upstream patches, fixing today's XSA 191, 192, 195, 197, 198. Bump PKGREVISIONs @ text @d1 1 a1 1 $NetBSD: $ @