- sw_64: Added sw64 architecture related updates - virtio-crypto: verify src&dst buffer length for sym request - vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present - qga: Fix suspend on Linux guests without systemd - tests: vhost-user-test: release mutex on protocol violation - qapi: support updating expected test output via make - block: Fix misleading hexadecimal format - block/rbd: fix write zeroes with growing images - block/nbd.c: Fixed IO request coroutine not being wakeup when kill NBD server - block/nfs: Fix 32-bit Windows build - qapi/qdev: Tidy up device_add documentation - hw/xen/xen_pt: fix uninitialized variable - migration/ram: Fix error handling in ram_write_tracking_start() - docs/about/build-platforms: Refine the distro support policy - xen-block: Avoid leaks on new error path - QGA VSS: Add wrapper to send log to debugger and stderr - chardev/char-socket: set s->listener = NULL in char_socket_finalize - qapi/block: Tidy up block-latency-histogram-set documentation - disas/riscv Fix ctzw disassemble - vfio: Fix vfio_get_dev_region() trace event - migration/ram: Fix populate_read_range() - Check and report for incomplete 'global' option format Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
From 017c7af0d5b928c6af60f8262c62d4c570b2e55e Mon Sep 17 00:00:00 2001
|
|
From: zhenwei pi <pizhenwei@bytedance.com>
|
|
Date: Thu, 3 Aug 2023 10:43:13 +0800
|
|
Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request
|
|
|
|
For symmetric algorithms, the length of ciphertext must be as same
|
|
as the plaintext.
|
|
The missing verification of the src_len and the dst_len in
|
|
virtio_crypto_sym_op_helper() may lead buffer overflow/divulged.
|
|
|
|
This patch is originally written by Yiming Tao for QEMU-SECURITY,
|
|
resend it(a few changes of error message) in qemu-devel.
|
|
|
|
Fixes: CVE-2023-3180
|
|
Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler")
|
|
Cc: Gonglei <arei.gonglei@huawei.com>
|
|
Cc: Mauro Matteo Cascella <mcascell@redhat.com>
|
|
Cc: Yiming Tao <taoym@zju.edu.cn>
|
|
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
|
|
Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
(cherry picked from commit 9d38a8434721a6479fe03fb5afb150ca793d3980)
|
|
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
---
|
|
hw/virtio/virtio-crypto.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
|
|
index 54f9bbb789..274c7b4dea 100644
|
|
--- a/hw/virtio/virtio-crypto.c
|
|
+++ b/hw/virtio/virtio-crypto.c
|
|
@@ -461,6 +461,11 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev,
|
|
return NULL;
|
|
}
|
|
|
|
+ if (unlikely(src_len != dst_len)) {
|
|
+ virtio_error(vdev, "sym request src len is different from dst len");
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
max_len = (uint64_t)iv_len + aad_len + src_len + dst_len + hash_result_len;
|
|
if (unlikely(max_len > vcrypto->conf.max_size)) {
|
|
virtio_error(vdev, "virtio-crypto too big length");
|
|
--
|
|
2.41.0.windows.1
|
|
|