summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Kumbhar <vkumbhar@mvista.com>2024-02-26 16:13:13 +0530
committerSteve Sakoman <steve@sakoman.com>2024-03-07 08:32:54 -1000
commit3c091d5d049f9970f38e368a041cf5d24046ea4b (patch)
tree263510d0c10d0fb365ad05d72740c6ab82163393
parentb9aad2ed8a0adda9a805b9314abfd28c954b2737 (diff)
downloadpoky-3c091d5d049f9970f38e368a041cf5d24046ea4b.tar.gz
qemu: Backport fix CVE-2023-6693
Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/2220e8189fb94068dbad333228659fbac819abb0] (From OE-Core rev: e993720fc31dbf94bed138b76ce33cbcd61ab9a5) Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2023-6693.patch74
2 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 18752af274..d3e6ced988 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -104,6 +104,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
104 file://CVE-2023-1544.patch \ 104 file://CVE-2023-1544.patch \
105 file://CVE-2023-5088.patch \ 105 file://CVE-2023-5088.patch \
106 file://CVE-2024-24474.patch \ 106 file://CVE-2024-24474.patch \
107 file://CVE-2023-6693.patch \
107 " 108 "
108UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 109UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
109 110
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2023-6693.patch b/meta/recipes-devtools/qemu/qemu/CVE-2023-6693.patch
new file mode 100644
index 0000000000..b91f2e6902
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2023-6693.patch
@@ -0,0 +1,74 @@
1From 2220e8189fb94068dbad333228659fbac819abb0 Mon Sep 17 00:00:00 2001
2From: Jason Wang <jasowang@redhat.com>
3Date: Tue, 2 Jan 2024 11:29:01 +0800
4Subject: [PATCH] virtio-net: correctly copy vnet header when flushing TX
5
6When HASH_REPORT is negotiated, the guest_hdr_len might be larger than
7the size of the mergeable rx buffer header. Using
8virtio_net_hdr_mrg_rxbuf during the header swap might lead a stack
9overflow in this case. Fixing this by using virtio_net_hdr_v1_hash
10instead.
11
12Reported-by: Xiao Lei <leixiao.nop@zju.edu.cn>
13Cc: Yuri Benditovich <yuri.benditovich@daynix.com>
14Cc: qemu-stable@nongnu.org
15Cc: Mauro Matteo Cascella <mcascell@redhat.com>
16Fixes: CVE-2023-6693
17Fixes: e22f0603fb2f ("virtio-net: reference implementation of hash report")
18Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
19Signed-off-by: Jason Wang <jasowang@redhat.com>
20
21Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/2220e8189fb94068dbad333228659fbac819abb0]
22CVE: CVE-2023-6693
23Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
24---
25 hw/net/virtio-net.c | 13 +++++++++----
26 1 file changed, 9 insertions(+), 4 deletions(-)
27
28diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
29index e1f474883..42e66697f 100644
30--- a/hw/net/virtio-net.c
31+++ b/hw/net/virtio-net.c
32@@ -600,6 +600,11 @@ static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
33
34 n->mergeable_rx_bufs = mergeable_rx_bufs;
35
36+ /*
37+ * Note: when extending the vnet header, please make sure to
38+ * change the vnet header copying logic in virtio_net_flush_tx()
39+ * as well.
40+ */
41 if (version_1) {
42 n->guest_hdr_len = hash_report ?
43 sizeof(struct virtio_net_hdr_v1_hash) :
44@@ -2520,7 +2525,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
45 ssize_t ret;
46 unsigned int out_num;
47 struct iovec sg[VIRTQUEUE_MAX_SIZE], sg2[VIRTQUEUE_MAX_SIZE + 1], *out_sg;
48- struct virtio_net_hdr_mrg_rxbuf mhdr;
49+ struct virtio_net_hdr_v1_hash vhdr;
50
51 elem = virtqueue_pop(q->tx_vq, sizeof(VirtQueueElement));
52 if (!elem) {
53@@ -2537,7 +2542,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
54 }
55
56 if (n->has_vnet_hdr) {
57- if (iov_to_buf(out_sg, out_num, 0, &mhdr, n->guest_hdr_len) <
58+ if (iov_to_buf(out_sg, out_num, 0, &vhdr, n->guest_hdr_len) <
59 n->guest_hdr_len) {
60 virtio_error(vdev, "virtio-net header incorrect");
61 virtqueue_detach_element(q->tx_vq, elem, 0);
62@@ -2545,8 +2550,8 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
63 return -EINVAL;
64 }
65 if (n->needs_vnet_hdr_swap) {
66- virtio_net_hdr_swap(vdev, (void *) &mhdr);
67- sg2[0].iov_base = &mhdr;
68+ virtio_net_hdr_swap(vdev, (void *) &vhdr);
69+ sg2[0].iov_base = &vhdr;
70 sg2[0].iov_len = n->guest_hdr_len;
71 out_num = iov_copy(&sg2[1], ARRAY_SIZE(sg2) - 1,
72 out_sg, out_num,
73--
742.34.1