Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1864939852 for ; Sun, 19 May 2024 10:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716113565; cv=none; b=inBuazamLk3FJ0+SPQwm9HJkgNBAmUsj8mZCYrleC0g8mKwOn/73wh1oe+P3w9IBNCaTMOsm3x8bhPLWQtjKIDLGiTiddehNkgUQX++9LY5gjZx/Fh04FJP2A9bXcE+yTgg2/hgDp9UUVg4+El6Y3YxsJFE440qkAE0KZ4ObRtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716113565; c=relaxed/simple; bh=QvUYVsTJn2lyTJT9PVhdW33R7NGDiNat3hYssIP6M4Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fZ91Nn+pCH3uiDSNBYPehwjO0fnEN6fnaRcMYSiI6owYX1Kbtp3RGGRyXlwXEcuzBrGKyVU/HP1p4i+SoS+TPji5hSypJcn2hfwY+QqgQ8gO+A3vvmIfn+wET2CCR58yNVRctZ+KCIL1EljKalMLT3aGkDJe+bN3jx7WypbcX2s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B60hB2vj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="B60hB2vj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92262C32781; Sun, 19 May 2024 10:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716113565; bh=QvUYVsTJn2lyTJT9PVhdW33R7NGDiNat3hYssIP6M4Y=; h=From:To:Cc:Subject:Date:Reply-to:From; b=B60hB2vj956ipG+h0rZv/bmSiUUrePyeWAvci/inUhAg+eTAwqbvmIw5FIb/JbP6j Hs9SPsvUOcEfA44uDVZaYV3q3EK2Bq1G/ZNeRK7DT52FeU8A9WSTHmL04DcJX36Ysu khQQRjTQ6YLhmadsxlPKNhOZeGMvkMpgcvJBqiL8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35944: VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host() Date: Sun, 19 May 2024 12:11:38 +0200 Message-ID: <2024051920-CVE-2024-35944-a860@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3764; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=QvUYVsTJn2lyTJT9PVhdW33R7NGDiNat3hYssIP6M4Y=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmeFzwe9rH6KdjMrviclGn4ckuWooVdsFnGCm+RIz/fn P2U/MOoI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACayJo5hnrnD/1eLjjYG342/ oPbhs6nw3o6lnAzzHW73lbR4TLvYmlDEw6wzK7Hpa/5XAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host() Syzkaller hit 'WARNING in dg_dispatch_as_host' bug. memcpy: detected field-spanning write (size 56) of single field "&dg_info->msg" at drivers/misc/vmw_vmci/vmci_datagram.c:237 (size 24) WARNING: CPU: 0 PID: 1555 at drivers/misc/vmw_vmci/vmci_datagram.c:237 dg_dispatch_as_host+0x88e/0xa60 drivers/misc/vmw_vmci/vmci_datagram.c:237 Some code commentry, based on my understanding: 544 #define VMCI_DG_SIZE(_dg) (VMCI_DG_HEADERSIZE + (size_t)(_dg)->payload_size) /// This is 24 + payload_size memcpy(&dg_info->msg, dg, dg_size); Destination = dg_info->msg ---> this is a 24 byte structure(struct vmci_datagram) Source = dg --> this is a 24 byte structure (struct vmci_datagram) Size = dg_size = 24 + payload_size {payload_size = 56-24 =32} -- Syzkaller managed to set payload_size to 32. 35 struct delayed_datagram_info { 36 struct datagram_entry *entry; 37 struct work_struct work; 38 bool in_dg_host_queue; 39 /* msg and msg_payload must be together. */ 40 struct vmci_datagram msg; 41 u8 msg_payload[]; 42 }; So those extra bytes of payload are copied into msg_payload[], a run time warning is seen while fuzzing with Syzkaller. One possible way to fix the warning is to split the memcpy() into two parts -- one -- direct assignment of msg and second taking care of payload. Gustavo quoted: "Under FORTIFY_SOURCE we should not copy data across multiple members in a structure." The Linux kernel CVE team has assigned CVE-2024-35944 to this issue. Affected and fixed versions =========================== Fixed in 4.19.312 with commit e87bb99d2df6 Fixed in 5.4.274 with commit f15eca95138b Fixed in 5.10.215 with commit ad78c5047dc4 Fixed in 5.15.155 with commit 130b0cd06487 Fixed in 6.1.86 with commit feacd430b42b Fixed in 6.6.27 with commit dae70a575656 Fixed in 6.8.6 with commit 491a1eb07c2b Fixed in 6.9 with commit 19b070fefd0d Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-35944 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/misc/vmw_vmci/vmci_datagram.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/e87bb99d2df6512d8ee37a5d63d2ca9a39a8c051 https://git.kernel.org/stable/c/f15eca95138b3d4ec17b63c3c1937b0aa0d3624b https://git.kernel.org/stable/c/ad78c5047dc4076d0b3c4fad4f42ffe9c86e8100 https://git.kernel.org/stable/c/130b0cd064874e0d0f58e18fb00e6f3993e90c74 https://git.kernel.org/stable/c/feacd430b42bbfa9ab3ed9e4f38b86c43e348c75 https://git.kernel.org/stable/c/dae70a57565686f16089737adb8ac64471570f73 https://git.kernel.org/stable/c/491a1eb07c2bd8841d63cb5263455e185be5866f https://git.kernel.org/stable/c/19b070fefd0d024af3daa7329cbc0d00de5302ec