summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch b/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch
new file mode 100644
index 0000000000..7144bdca46
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch
@@ -0,0 +1,49 @@
1From 9d38a8434721a6479fe03fb5afb150ca793d3980 Mon Sep 17 00:00:00 2001
2From: zhenwei pi <pizhenwei@bytedance.com>
3Date: Thu, 3 Aug 2023 10:43:13 +0800
4Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request
5
6For symmetric algorithms, the length of ciphertext must be as same
7as the plaintext.
8The missing verification of the src_len and the dst_len in
9virtio_crypto_sym_op_helper() may lead buffer overflow/divulged.
10
11This patch is originally written by Yiming Tao for QEMU-SECURITY,
12resend it(a few changes of error message) in qemu-devel.
13
14Fixes: CVE-2023-3180
15Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler")
16Cc: Gonglei <arei.gonglei@huawei.com>
17Cc: Mauro Matteo Cascella <mcascell@redhat.com>
18Cc: Yiming Tao <taoym@zju.edu.cn>
19Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
20Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com>
21Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
22Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
23
24Upstream-Status: Backport from [https://gitlab.com/qemu-project/qemu/-/commit/9d38a8434721a6479fe03fb5afb150ca793d3980]
25CVE: CVE-2023-3180
26Signed-off-by: Ashish Sharma <asharma@mvista.com>
27
28 hw/virtio/virtio-crypto.c | 5 +++++
29 1 file changed, 5 insertions(+)
30
31diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
32index 44faf5a522b..13aec771e11 100644
33--- a/hw/virtio/virtio-crypto.c
34+++ b/hw/virtio/virtio-crypto.c
35@@ -634,6 +634,11 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev,
36 return NULL;
37 }
38
39+ if (unlikely(src_len != dst_len)) {
40+ virtio_error(vdev, "sym request src len is different from dst len");
41+ return NULL;
42+ }
43+
44 max_len = (uint64_t)iv_len + aad_len + src_len + dst_len + hash_result_len;
45 if (unlikely(max_len > vcrypto->conf.max_size)) {
46 virtio_error(vdev, "virtio-crypto too big length");
47--
48GitLab
49