From nobody Sat May 30 20:11:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1776354915; cv=none; d=zohomail.com; s=zohoarc; b=VuXDZXsia7YwhYjFyauG3E9uHfSikFe41d1uuekli3zi8Bjzes+17K85fH2IzXbfD2f8j1qWbASkXfiOE/rdL0vQs8dEI168AtuRsDLA4CKzJZpNERt/E+Ba2cL2MOcMxroHHGYcMJx3R7SSeLem1onz9iIiIpK8WteOy5YTNhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776354915; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=maqXsqGZVCaDcYrNfMhqYGS2tEX+eHXVzzX9jtP1ODM=; b=az2sHXtn/pJLRCeI5uM+tJxQ2M0QJcO5Bt8Is3+lCbltcCqgmWvSwCJ/4hBYSKXL8RrilAAqwbPb1Yito1DEWJPNYElbVAtAuqJRwvkzmZVdpRsEZbyQxXtuxsYgTam8sJDarm4CHrISsQOeW805+D67gsILiLi6i3Xe+BqQl0U= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776354915140878.6524048864907; Thu, 16 Apr 2026 08:55:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDP38-0002LT-0o; Thu, 16 Apr 2026 11:54:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDP36-0002Ik-OL for qemu-devel@nongnu.org; Thu, 16 Apr 2026 11:54:36 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDP33-00040T-VZ for qemu-devel@nongnu.org; Thu, 16 Apr 2026 11:54:36 -0400 Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fxMy40wsfzHnGkW; Thu, 16 Apr 2026 23:54:04 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id 6E3A240584; Thu, 16 Apr 2026 23:54:22 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.123.51.176) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 16 Apr 2026 16:54:21 +0100 To: , , , CC: , Subject: [PATCH qemu] hw/cxl: Avoid out of bounds read when userspace requests data off end of CDAT. Date: Thu, 16 Apr 2026 16:54:21 +0100 Message-ID: <20260416155421.9876-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.123.51.176] X-ClientProxiedBy: lhrpeml100010.china.huawei.com (7.191.174.197) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1776354916410158500 Content-Type: text/plain; charset="utf-8" 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. Fixes: f5ee7413d592 ("hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange") Fixes: 882877fc359d ("hw/pci-bridge/cxl-upstream: Add a CDAT table access D= OE") Reported-by: Buzzy Signed-off-by: Jonathan Cameron Cc: --- hw/mem/cxl_type3.c | 4 ++++ hw/pci-bridge/cxl_upstream.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 4739239da3c5..763b6a024403 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -278,6 +278,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } =20 ent =3D req->entry_handle; + if (ent >=3D cdat->entry_len) { + return false; + } + base =3D cdat->entry[ent].base; len =3D cdat->entry[ent].length; =20 diff --git a/hw/pci-bridge/cxl_upstream.c b/hw/pci-bridge/cxl_upstream.c index b6281cbd4cb0..fa53fa2777fd 100644 --- a/hw/pci-bridge/cxl_upstream.c +++ b/hw/pci-bridge/cxl_upstream.c @@ -158,6 +158,10 @@ static bool cxl_doe_cdat_rsp(DOECap *doe_cap) } =20 ent =3D req->entry_handle; + if (ent >=3D cdat->entry_len) { + return false; + } + base =3D cdat->entry[ent].base; len =3D cdat->entry[ent].length; =20 --=20 2.51.0