Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/nvme: fix oob memory read in fdp events log
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: 73064ed ("hw/nvme: flexible data placement emulation")
Reported-by: Trend Micro's Zero Day Initiative
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
  • Loading branch information
birkelund committed Aug 7, 2023
1 parent 9400601 commit ecb1b7b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hw/nvme/ctrl.c
Expand Up @@ -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);
Expand Down

3 comments on commit ecb1b7b

@ypanch
Copy link

@ypanch ypanch commented on ecb1b7b Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this CVE apply to QEMU versions < 8.0.0? We are using version 6.2.0 and there is no function nvme_fdp_events

@hewenjia
Copy link

@hewenjia hewenjia commented on ecb1b7b Aug 17, 2023 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyjuntion
Copy link

@yyjuntion yyjuntion commented on ecb1b7b Aug 17, 2023 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.