diff options
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2023-3180.patch | 49 |
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 @@ | |||
1 | From 9d38a8434721a6479fe03fb5afb150ca793d3980 Mon Sep 17 00:00:00 2001 | ||
2 | From: zhenwei pi <pizhenwei@bytedance.com> | ||
3 | Date: Thu, 3 Aug 2023 10:43:13 +0800 | ||
4 | Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request | ||
5 | |||
6 | For symmetric algorithms, the length of ciphertext must be as same | ||
7 | as the plaintext. | ||
8 | The missing verification of the src_len and the dst_len in | ||
9 | virtio_crypto_sym_op_helper() may lead buffer overflow/divulged. | ||
10 | |||
11 | This patch is originally written by Yiming Tao for QEMU-SECURITY, | ||
12 | resend it(a few changes of error message) in qemu-devel. | ||
13 | |||
14 | Fixes: CVE-2023-3180 | ||
15 | Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler") | ||
16 | Cc: Gonglei <arei.gonglei@huawei.com> | ||
17 | Cc: Mauro Matteo Cascella <mcascell@redhat.com> | ||
18 | Cc: Yiming Tao <taoym@zju.edu.cn> | ||
19 | Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> | ||
20 | Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com> | ||
21 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
22 | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | ||
23 | |||
24 | Upstream-Status: Backport from [https://gitlab.com/qemu-project/qemu/-/commit/9d38a8434721a6479fe03fb5afb150ca793d3980] | ||
25 | CVE: CVE-2023-3180 | ||
26 | Signed-off-by: Ashish Sharma <asharma@mvista.com> | ||
27 | |||
28 | hw/virtio/virtio-crypto.c | 5 +++++ | ||
29 | 1 file changed, 5 insertions(+) | ||
30 | |||
31 | diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c | ||
32 | index 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 | -- | ||
48 | GitLab | ||
49 | |||