[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.0.5 07/43] hw/nvme: fix oob memory read in fdp events log
From: |
Michael Tokarev |
Subject: |
[Stable-8.0.5 07/43] hw/nvme: fix oob memory read in fdp events log |
Date: |
Sat, 9 Sep 2023 15:59:33 +0300 |
From: Klaus Jensen <k.jensen@samsung.com>
As reported by Trend Micro's Zero Day Initiative, an oob memory read
vulnerability exists in nvme_fdp_events(). The host-provided offset is
not verified.
Fix this.
This is only exploitable when Flexible Data Placement mode (fdp=on) is
enabled.
Fixes: CVE-2023-4135
Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
Reported-by: Trend Micro's Zero Day Initiative
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit ecb1b7b082d3b7dceff0e486a114502fc52c0fdf)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2097fb1310..5830048804 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5091,6 +5091,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t
endgrpid,
}
log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);
+
+ if (off >= log_size) {
+ return NVME_INVALID_FIELD | NVME_DNR;
+ }
+
trans_len = MIN(log_size - off, buf_len);
elog = g_malloc0(log_size);
elog->num_events = cpu_to_le32(ebuf->nelems);
--
2.39.2
- [Stable-8.0.5 00/43] Patch Round-up for stable 8.0.5, freeze on 2023-09-19, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 01/43] machine: Add helpers to get cores/threads per socket, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 02/43] hw/smbios: Fix smbios_smp_sockets caculation, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 03/43] hw/smbios: Fix thread count in type4, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 04/43] hw/smbios: Fix core count in type4, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 05/43] hw/i2c: Fix bitbang_i2c_data trace event, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 06/43] dump: kdump-zlib data pages not dumped with pvtime/aarch64, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 07/43] hw/nvme: fix oob memory read in fdp events log,
Michael Tokarev <=
- [Stable-8.0.5 08/43] hw/nvme: fix compliance issue wrt. iosqes/iocqes, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 09/43] hw/nvme: fix CRC64 for guard tag, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 10/43] hw/nvme: fix null pointer access in directive receive, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 11/43] hw/nvme: fix null pointer access in ruh update, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 12/43] linux-user/elfload: Set V in ELF_HWCAP for RISC-V, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 13/43] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 14/43] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 16/43] hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 15/43] Fixed incorrect LLONG alignment for openrisc and cris, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 18/43] target/s390x: Use a 16-bit immediate in VREP, Michael Tokarev, 2023/09/09