summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2016-10-10 22:29:43 +0300
committerEfraim Flashner <efraim@flashner.co.il>2016-10-11 10:59:07 +0300
commitbde70caa0624bc2ca2de7a183b00e9c455ddd803 (patch)
treea9da7c26ef947a445b73a95ba10a64b8b9e5c58f
parent8f941dd24fdf41656175a635deaee79ca0242101 (diff)
gnu: qemu: Patch CVE-2016-857{6,7,8}.
* gnu/packages/qemu.scm (qemu)[source]: Add patches. * gnu/packages/patches/qemu-CVE-2016-8576.patch, gnu/packages/patches/qemu-CVE-2016-8577.patch, gnu/packages/patches/qemu-CVE-2016-8578.patch: New files. * gnu/local.mk (dist_patch_DATA): Register them.
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/patches/qemu-CVE-2016-8576.patch62
-rw-r--r--gnu/packages/patches/qemu-CVE-2016-8577.patch36
-rw-r--r--gnu/packages/patches/qemu-CVE-2016-8578.patch27
-rw-r--r--gnu/packages/qemu.scm5
5 files changed, 132 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 526756f08ef..0e705511e58 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -809,6 +809,9 @@ dist_patch_DATA = \
809 %D%/packages/patches/python-paste-remove-website-test.patch \ 809 %D%/packages/patches/python-paste-remove-website-test.patch \
810 %D%/packages/patches/python-paste-remove-timing-test.patch \ 810 %D%/packages/patches/python-paste-remove-timing-test.patch \
811 %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \ 811 %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
812 %D%/packages/patches/qemu-CVE-2016-8576.patch \
813 %D%/packages/patches/qemu-CVE-2016-8577.patch \
814 %D%/packages/patches/qemu-CVE-2016-8578.patch \
812 %D%/packages/patches/qt4-ldflags.patch \ 815 %D%/packages/patches/qt4-ldflags.patch \
813 %D%/packages/patches/quickswitch-fix-dmenu-check.patch \ 816 %D%/packages/patches/quickswitch-fix-dmenu-check.patch \
814 %D%/packages/patches/rapicorn-isnan.patch \ 817 %D%/packages/patches/rapicorn-isnan.patch \
diff --git a/gnu/packages/patches/qemu-CVE-2016-8576.patch b/gnu/packages/patches/qemu-CVE-2016-8576.patch
new file mode 100644
index 00000000000..5031b59d816
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2016-8576.patch
@@ -0,0 +1,62 @@
1From 20009bdaf95d10bf748fa69b104672d3cfaceddf Mon Sep 17 00:00:00 2001
2From: Gerd Hoffmann <kraxel@redhat.com>
3Date: Fri, 7 Oct 2016 10:15:29 +0200
4Subject: [PATCH] xhci: limit the number of link trbs we are willing to process
5
6Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7---
8 hw/usb/hcd-xhci.c | 10 ++++++++++
9 1 file changed, 10 insertions(+)
10
11diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
12index 726435c..ee4fa48 100644
13--- a/hw/usb/hcd-xhci.c
14+++ b/hw/usb/hcd-xhci.c
15@@ -54,6 +54,8 @@
16 * to the specs when it gets them */
17 #define ER_FULL_HACK
18
19+#define TRB_LINK_LIMIT 4
20+
21 #define LEN_CAP 0x40
22 #define LEN_OPER (0x400 + 0x10 * MAXPORTS)
23 #define LEN_RUNTIME ((MAXINTRS + 1) * 0x20)
24@@ -1000,6 +1002,7 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
25 dma_addr_t *addr)
26 {
27 PCIDevice *pci_dev = PCI_DEVICE(xhci);
28+ uint32_t link_cnt = 0;
29
30 while (1) {
31 TRBType type;
32@@ -1026,6 +1029,9 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRing *ring, XHCITRB *trb,
33 ring->dequeue += TRB_SIZE;
34 return type;
35 } else {
36+ if (++link_cnt > TRB_LINK_LIMIT) {
37+ return 0;
38+ }
39 ring->dequeue = xhci_mask64(trb->parameter);
40 if (trb->control & TRB_LK_TC) {
41 ring->ccs = !ring->ccs;
42@@ -1043,6 +1049,7 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
43 bool ccs = ring->ccs;
44 /* hack to bundle together the two/three TDs that make a setup transfer */
45 bool control_td_set = 0;
46+ uint32_t link_cnt = 0;
47
48 while (1) {
49 TRBType type;
50@@ -1058,6 +1065,9 @@ static int xhci_ring_chain_length(XHCIState *xhci, const XHCIRing *ring)
51 type = TRB_TYPE(trb);
52
53 if (type == TR_LINK) {
54+ if (++link_cnt > TRB_LINK_LIMIT) {
55+ return -length;
56+ }
57 dequeue = xhci_mask64(trb.parameter);
58 if (trb.control & TRB_LK_TC) {
59 ccs = !ccs;
60--
611.8.3.1
62
diff --git a/gnu/packages/patches/qemu-CVE-2016-8577.patch b/gnu/packages/patches/qemu-CVE-2016-8577.patch
new file mode 100644
index 00000000000..c4132d2fb13
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2016-8577.patch
@@ -0,0 +1,36 @@
1Subject: [Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read
2From: Li Qiang <liq3ea@gmail.com>
3
4In 9pfs read dispatch function, it doesn't free two QEMUIOVector
5object thus causing potential memory leak. This patch avoid this.
6
7Signed-off-by: Li Qiang <liq3ea@gmail.com>
8---
9 hw/9pfs/9p.c | 5 +++--
10 1 file changed, 3 insertions(+), 2 deletions(-)
11
12diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
13index 119ee58..543a791 100644
14--- a/hw/9pfs/9p.c
15+++ b/hw/9pfs/9p.c
16@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
17 if (len < 0) {
18 /* IO error return the error */
19 err = len;
20- goto out;
21+ goto out_free_iovec;
22 }
23 } while (count < max_count && len > 0);
24 err = pdu_marshal(pdu, offset, "d", count);
25 if (err < 0) {
26- goto out;
27+ goto out_free_iovec;
28 }
29 err += offset + count;
30+out_free_iovec:
31 qemu_iovec_destroy(&qiov);
32 qemu_iovec_destroy(&qiov_full);
33 } else if (fidp->fid_type == P9_FID_XATTR) {
34--
351.8.3.1
36
diff --git a/gnu/packages/patches/qemu-CVE-2016-8578.patch b/gnu/packages/patches/qemu-CVE-2016-8578.patch
new file mode 100644
index 00000000000..92ba365727b
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2016-8578.patch
@@ -0,0 +1,27 @@
1From: Li Qiang <liq3ea@gmail.com>
2
3In 9pfs function v9fs_iov_vunmarshal, it will not allocate space
4for empty string. This will cause several NULL pointer dereference
5issues. this patch fix this issue.
6
7Signed-off-by: Li Qiang <liq3ea@gmail.com>
8---
9 fsdev/9p-iov-marshal.c | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
13index 663cad5..1d16f8d 100644
14--- a/fsdev/9p-iov-marshal.c
15+++ b/fsdev/9p-iov-marshal.c
16@@ -125,7 +125,7 @@ ssize_t v9fs_iov_vunmarshal(struct iovec *out_sg, int out_num, size_t offset,
17 str->data = g_malloc(str->size + 1);
18 copied = v9fs_unpack(str->data, out_sg, out_num, offset,
19 str->size);
20- if (copied > 0) {
21+ if (copied >= 0) {
22 str->data[str->size] = 0;
23 } else {
24 v9fs_string_free(str);
25--
261.8.3.1
27
diff --git a/gnu/packages/qemu.scm b/gnu/packages/qemu.scm
index aee6a75f0e9..9bf8c3afbde 100644
--- a/gnu/packages/qemu.scm
+++ b/gnu/packages/qemu.scm
@@ -76,7 +76,10 @@
76 version ".tar.bz2")) 76 version ".tar.bz2"))
77 (sha256 77 (sha256
78 (base32 78 (base32
79 "0lqyz01z90nvxpc3nx4djbci7hx62cwvs5zwd6phssds0sap6vij")))) 79 "0lqyz01z90nvxpc3nx4djbci7hx62cwvs5zwd6phssds0sap6vij"))
80 (patches (search-patches "qemu-CVE-2016-8576.patch"
81 "qemu-CVE-2016-8577.patch"
82 "qemu-CVE-2016-8578.patch"))))
80 (build-system gnu-build-system) 83 (build-system gnu-build-system)
81 (arguments 84 (arguments
82 '(;; Running tests in parallel can occasionally lead to failures, like: 85 '(;; Running tests in parallel can occasionally lead to failures, like: