hw/cxl: Avoid out of bounds read when userspace requests data off end of CDAT.
PATCH 1/1 hw/cxl: Avoid out of bounds read when userspace requests data off end of CDAT.
The requested entry is controlled by the guest so must be checked against the number of entries that actually exist.
Reported as a security issue, but CXL emulation has since been declared to not be suitable (yet) for virtualization use cases and so the security handling policy does not apply.
--- hw/mem/cxl_type3.c | 4 ++++ hw/pci-bridge/cxl_upstream.c | 4 ++++ 2 files changed, 8 insertions(+)
hw/mem/cxl_type3.c +4 -0
@@ -278,6 +278,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } ent = req->entry_handle; +if (ent >= cdat->entry_len) { +return false; + } + base = cdat->entry[ent].base; len = cdat->entry[ent].length;
hw/pci-bridge/cxl_upstream.c +4 -0
@@ -158,6 +158,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } ent = req->entry_handle; +if (ent >= cdat->entry_len) { +return false; + } + base = cdat->entry[ent].base; len = cdat->entry[ent].length;
Signature · 1 line
2.51.0
Quoted 7 lines · On Thu, 16 Apr 2026 16:54:21 +0100 Jonathan Cameron via qemu development…
The requested entry is controlled by the guest so must be checked against the number of entries that actually exist.
Reported as a security issue, but CXL emulation has since been declared to not be suitable (yet) for virtualization use cases and so the security handling policy does not apply.
Quoted 5 lines
Fixes f5ee7413d592 ("hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange")Fixes 882877fc359d ("hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE")Reported-by Buzzy <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>Cc <[email protected]>
I have a very short memory it seems and forgot to add linux-cxl despite adding it to the MAINTAINERS entry yesterday.
Quoted 35 lines
--- hw/mem/cxl_type3.c | 4 ++++ hw/pci-bridge/cxl_upstream.c | 4 ++++ 2 files changed, 8 insertions(+)hw/mem/cxl_type3.c +4
-0@@ -278,6 +278,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } ent = req->entry_handle; +if (ent >= cdat->entry_len) { +return false; + } + base = cdat->entry[ent].base; len = cdat->entry[ent].length;hw/pci-bridge/cxl_upstream.c +4
-0@@ -158,6 +158,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } ent = req->entry_handle; +if (ent >= cdat->entry_len) { +return false; + } + base = cdat->entry[ent].base; len = cdat->entry[ent].length;