hw/nvme: fix oob memory read in fdp events log
PATCH 1/1 hw/nvme: fix oob memory read in fdp events log
From: Klaus Jensen <[email protected]>
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 <[email protected]>
--- hw/nvme/ctrl.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/nvme/ctrl.c +5 -0
@@ -5120,6 +5120,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);
Signature · 1 line
2.41.0
+CC qemu-stable
Quoted 38 lines · Klaus Jensen
From: Klaus Jensen <[email protected]>
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-4135Fixes 73064edfb864 ("hw/nvme: flexible data placement emulation")Reported-by Trend Micro's Zero Day InitiativeSigned-off-by Klaus Jensen <[email protected]>--- hw/nvme/ctrl.c | 5 +++++ 1 file changed, 5 insertions(+)hw/nvme/ctrl.c +5
-0@@ -5120,6 +5120,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);Signature · 1 line
2.41.0
Signature · 1 line
One of us - No more doubt, silence or taboo about mental illness.