]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/virtio-iommu: Fix potential OOB access in virtio_iommu_handle_command()
authorEric Auger <eric.auger@redhat.com>
Mon, 17 Jul 2023 16:21:26 +0000 (18:21 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 4 Aug 2023 04:24:54 +0000 (07:24 +0300)
commitc315f738419084388722b405c9a3c2aa87b460cf
tree260ea5d8c72ae63fef1f45b89ba26fbfe973f672
parent5bbd0924955720947c9867d9f78a5d3c85e241c7
hw/virtio-iommu: Fix potential OOB access in virtio_iommu_handle_command()

In the virtio_iommu_handle_command() when a PROBE request is handled,
output_size takes a value greater than the tail size and on a subsequent
iteration we can get a stack out-of-band access. Initialize the
output_size on each iteration.

The issue was found with ASAN. Credits to:
Yiming Tao(Zhejiang University)
Gaoning Pan(Zhejiang University)

Fixes: 1733eebb9e7 ("virtio-iommu: Implement RESV_MEM probe request")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Mauro Matteo Cascella <mcascell@redhat.com>
Cc: qemu-stable@nongnu.org
Message-Id: <20230717162126.11693-1-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit cf2f89edf36a59183166ae8721a8d7ab5cd286bd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/virtio/virtio-iommu.c