summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorHitendra Prajapati <hprajapati@mvista.com>2024-07-03 12:52:39 +0530
committerSteve Sakoman <steve@sakoman.com>2024-07-09 06:02:55 -0700
commit402351d0e05d6790977afba99fcffccafa028599 (patch)
tree86e26b1398f151d722c51e446f8f3e671204a3af /meta
parente7a2a24cc758eaa6ef04604c1cf1d8bbf31a8a9c (diff)
downloadpoky-402351d0e05d6790977afba99fcffccafa028599.tar.gz
QEMU: Fix CVE-2024-3446 & CVE-2024-3567
Backport fixes for: * CVE-2024-3446 - Upstream-Status: Backport from https://gitlab.com/qemu-project/qemu/-/commit/eb546a3f49f45e6870ec91d792cd09f8a662c16e && https://gitlab.com/qemu-project/qemu/-/commit/4f01537ced3e787bd985b8f8de5869b92657160a && https://gitlab.com/qemu-project/qemu/-/commit/fbeb0a160cbcc067c0e1f0d380cea4a31de213e3 && https://gitlab.com/qemu-project/qemu/-/commit/1b2a52712b249e14d246cd9c7db126088e6e64db * CVE-2024-3567 - Upstream-Status: Backport from https://gitlab.com/qemu-project/qemu/-/commit/1cfe45956e03070f894e91b304e233b4d5b99719 (From OE-Core rev: 9e22481ec84800b97d8908d57aed118895b16224) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc5
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-3446-01.patch73
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-3446-02.patch48
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-3446-03.patch47
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-3446-04.patch52
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2024-3567.patch48
6 files changed, 273 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 4501f84c2b..d22bc31ce3 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -42,6 +42,11 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
42 file://CVE-2023-6683.patch \ 42 file://CVE-2023-6683.patch \
43 file://qemu-guest-agent.init \ 43 file://qemu-guest-agent.init \
44 file://qemu-guest-agent.udev \ 44 file://qemu-guest-agent.udev \
45 file://CVE-2024-3446-01.patch \
46 file://CVE-2024-3446-02.patch \
47 file://CVE-2024-3446-03.patch \
48 file://CVE-2024-3446-04.patch \
49 file://CVE-2024-3567.patch \
45 " 50 "
46UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 51UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
47 52
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-01.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-01.patch
new file mode 100644
index 0000000000..15dbca92cd
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-01.patch
@@ -0,0 +1,73 @@
1rom eb546a3f49f45e6870ec91d792cd09f8a662c16e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
3Date: Thu, 4 Apr 2024 20:56:11 +0200
4Subject: [PATCH] hw/virtio: Introduce virtio_bh_new_guarded() helper
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Introduce virtio_bh_new_guarded(), similar to qemu_bh_new_guarded()
10but using the transport memory guard, instead of the device one
11(there can only be one virtio device per virtio bus).
12
13Inspired-by: Gerd Hoffmann <kraxel@redhat.com>
14Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
15Acked-by: Michael S. Tsirkin <mst@redhat.com>
16Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
17Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
18Message-Id: <20240409105537.18308-2-philmd@linaro.org>
19(cherry picked from commit ec0504b989ca61e03636384d3602b7bf07ffe4da)
20Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
21
22Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/eb546a3f49f45e6870ec91d792cd09f8a662c16e]
23CVE: CVE-2024-3446
24Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
25---
26 hw/virtio/virtio.c | 10 ++++++++++
27 include/hw/virtio/virtio.h | 7 +++++++
28 2 files changed, 17 insertions(+)
29
30diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
31index 3a160f86e..8590b8971 100644
32--- a/hw/virtio/virtio.c
33+++ b/hw/virtio/virtio.c
34@@ -4095,3 +4095,13 @@ static void virtio_register_types(void)
35 }
36
37 type_init(virtio_register_types)
38+
39+QEMUBH *virtio_bh_new_guarded_full(DeviceState *dev,
40+ QEMUBHFunc *cb, void *opaque,
41+ const char *name)
42+{
43+ DeviceState *transport = qdev_get_parent_bus(dev)->parent;
44+
45+ return qemu_bh_new_full(cb, opaque, name,
46+ &transport->mem_reentrancy_guard);
47+}
48diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
49index c8f72850b..7d5ffdc14 100644
50--- a/include/hw/virtio/virtio.h
51+++ b/include/hw/virtio/virtio.h
52@@ -22,6 +22,7 @@
53 #include "standard-headers/linux/virtio_config.h"
54 #include "standard-headers/linux/virtio_ring.h"
55 #include "qom/object.h"
56+#include "block/aio.h"
57
58 /*
59 * A guest should never accept this. It implies negotiation is broken
60@@ -508,4 +509,10 @@ static inline bool virtio_device_disabled(VirtIODevice *vdev)
61 bool virtio_legacy_allowed(VirtIODevice *vdev);
62 bool virtio_legacy_check_disabled(VirtIODevice *vdev);
63
64+QEMUBH *virtio_bh_new_guarded_full(DeviceState *dev,
65+ QEMUBHFunc *cb, void *opaque,
66+ const char *name);
67+#define virtio_bh_new_guarded(dev, cb, opaque) \
68+ virtio_bh_new_guarded_full((dev), (cb), (opaque), (stringify(cb)))
69+
70 #endif
71--
722.25.1
73
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-02.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-02.patch
new file mode 100644
index 0000000000..843ed43ba8
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-02.patch
@@ -0,0 +1,48 @@
1From 4f01537ced3e787bd985b8f8de5869b92657160a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
3Date: Thu, 4 Apr 2024 20:56:41 +0200
4Subject: [PATCH] hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Replace qemu_bh_new_guarded() by virtio_bh_new_guarded()
10so the bus and device use the same guard. Otherwise the
11DMA-reentrancy protection can be bypassed.
12
13Fixes: CVE-2024-3446
14Cc: qemu-stable@nongnu.org
15Suggested-by: Alexander Bulekov <alxndr@bu.edu>
16Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
17Acked-by: Michael S. Tsirkin <mst@redhat.com>
18Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
20Message-Id: <20240409105537.18308-5-philmd@linaro.org>
21(cherry picked from commit f4729ec39ad97a42ceaa7b5697f84f440ea6e5dc)
22Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
23
24Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/4f01537ced3e787bd985b8f8de5869b92657160a]
25CVE: CVE-2024-3446
26Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
27---
28 hw/virtio/virtio-crypto.c | 4 ++--
29 1 file changed, 2 insertions(+), 2 deletions(-)
30
31diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
32index 0e2cc8d5a..4aaced74b 100644
33--- a/hw/virtio/virtio-crypto.c
34+++ b/hw/virtio/virtio-crypto.c
35@@ -1080,8 +1080,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
36 vcrypto->vqs[i].dataq =
37 virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh);
38 vcrypto->vqs[i].dataq_bh =
39- qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i],
40- &dev->mem_reentrancy_guard);
41+ virtio_bh_new_guarded(dev, virtio_crypto_dataq_bh,
42+ &vcrypto->vqs[i]);
43 vcrypto->vqs[i].vcrypto = vcrypto;
44 }
45
46--
472.25.1
48
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-03.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-03.patch
new file mode 100644
index 0000000000..a24652dea3
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-03.patch
@@ -0,0 +1,47 @@
1From fbeb0a160cbcc067c0e1f0d380cea4a31de213e3 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
3Date: Thu, 4 Apr 2024 20:56:35 +0200
4Subject: [PATCH] hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Replace qemu_bh_new_guarded() by virtio_bh_new_guarded()
10so the bus and device use the same guard. Otherwise the
11DMA-reentrancy protection can be bypassed.
12
13Fixes: CVE-2024-3446
14Cc: qemu-stable@nongnu.org
15Suggested-by: Alexander Bulekov <alxndr@bu.edu>
16Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
17Acked-by: Michael S. Tsirkin <mst@redhat.com>
18Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
20Message-Id: <20240409105537.18308-4-philmd@linaro.org>
21(cherry picked from commit b4295bff25f7b50de1d9cc94a9c6effd40056bca)
22Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
23
24Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/fbeb0a160cbcc067c0e1f0d380cea4a31de213e3]
25CVE: CVE-2024-3446
26Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
27---
28 hw/char/virtio-serial-bus.c | 3 +--
29 1 file changed, 1 insertion(+), 2 deletions(-)
30
31diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
32index dd619f073..1221fb7f1 100644
33--- a/hw/char/virtio-serial-bus.c
34+++ b/hw/char/virtio-serial-bus.c
35@@ -985,8 +985,7 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
36 return;
37 }
38
39- port->bh = qemu_bh_new_guarded(flush_queued_data_bh, port,
40- &dev->mem_reentrancy_guard);
41+ port->bh = virtio_bh_new_guarded(dev, flush_queued_data_bh, port);
42 port->elem = NULL;
43 }
44
45--
462.25.1
47
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-04.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-04.patch
new file mode 100644
index 0000000000..7f0293242d
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-3446-04.patch
@@ -0,0 +1,52 @@
1From 1b2a52712b249e14d246cd9c7db126088e6e64db Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
3Date: Thu, 4 Apr 2024 20:56:27 +0200
4Subject: [PATCH] hw/display/virtio-gpu: Protect from DMA re-entrancy bugs
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9qemu-system-i386: warning: Blocked re-entrant IO on MemoryRegion: virtio-pci-common-virtio-gpu at addr: 0x6
10
11Fixes: CVE-2024-3446
12Cc: qemu-stable@nongnu.org
13Reported-by: Alexander Bulekov <alxndr@bu.edu>
14Reported-by: Yongkang Jia <kangel@zju.edu.cn>
15Reported-by: Xiao Lei <nop.leixiao@gmail.com>
16Reported-by: Yiming Tao <taoym@zju.edu.cn>
17Buglink: https://bugs.launchpad.net/qemu/+bug/1888606
18Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
19Acked-by: Michael S. Tsirkin <mst@redhat.com>
20Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
21Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
22Message-Id: <20240409105537.18308-3-philmd@linaro.org>
23(cherry picked from commit ba28e0ff4d95b56dc334aac2730ab3651ffc3132)
24Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
25
26Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/1b2a52712b249e14d246cd9c7db126088e6e64db]
27CVE: CVE-2024-3446
28Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
29---
30 hw/display/virtio-gpu.c | 6 ++----
31 1 file changed, 2 insertions(+), 4 deletions(-)
32
33diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
34index b016d3bac..a7b16ba07 100644
35--- a/hw/display/virtio-gpu.c
36+++ b/hw/display/virtio-gpu.c
37@@ -1463,10 +1463,8 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
38
39 g->ctrl_vq = virtio_get_queue(vdev, 0);
40 g->cursor_vq = virtio_get_queue(vdev, 1);
41- g->ctrl_bh = qemu_bh_new_guarded(virtio_gpu_ctrl_bh, g,
42- &qdev->mem_reentrancy_guard);
43- g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
44- &qdev->mem_reentrancy_guard);
45+ g->ctrl_bh = virtio_bh_new_guarded(qdev, virtio_gpu_ctrl_bh, g);
46+ g->cursor_bh = virtio_bh_new_guarded(qdev, virtio_gpu_cursor_bh, g);
47 g->reset_bh = qemu_bh_new(virtio_gpu_reset_bh, g);
48 qemu_cond_init(&g->reset_cond);
49 QTAILQ_INIT(&g->reslist);
50--
512.25.1
52
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2024-3567.patch b/meta/recipes-devtools/qemu/qemu/CVE-2024-3567.patch
new file mode 100644
index 0000000000..f14178f881
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2024-3567.patch
@@ -0,0 +1,48 @@
1From 1cfe45956e03070f894e91b304e233b4d5b99719 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
3Date: Tue, 9 Apr 2024 19:54:05 +0200
4Subject: [PATCH] hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9If a fragmented packet size is too short, do not try to
10calculate its checksum.
11
12Fixes: CVE-2024-3567
13Cc: qemu-stable@nongnu.org
14Reported-by: Zheyu Ma <zheyuma97@gmail.com>
15Fixes: f199b13bc1 ("igb: Implement Tx SCTP CSO")
16Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2273
17Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
18Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
19Acked-by: Jason Wang <jasowang@redhat.com>
20Message-Id: <20240410070459.49112-1-philmd@linaro.org>
21(cherry picked from commit 83ddb3dbba2ee0f1767442ae6ee665058aeb1093)
22Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
23
24Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/1cfe45956e03070f894e91b304e233b4d5b99719]
25CVE: CVE-2024-3567
26Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
27---
28 hw/net/net_tx_pkt.c | 4 ++++
29 1 file changed, 4 insertions(+)
30
31diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
32index 2e5f58b3c..d40d508a1 100644
33--- a/hw/net/net_tx_pkt.c
34+++ b/hw/net/net_tx_pkt.c
35@@ -141,6 +141,10 @@ bool net_tx_pkt_update_sctp_checksum(struct NetTxPkt *pkt)
36 uint32_t csum = 0;
37 struct iovec *pl_start_frag = pkt->vec + NET_TX_PKT_PL_START_FRAG;
38
39+ if (iov_size(pl_start_frag, pkt->payload_frags) < 8 + sizeof(csum)) {
40+ return false;
41+ }
42+
43 if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) {
44 return false;
45 }
46--
472.25.1
48