From mboxrd@z Thu Jan 1 00:00:00 1970 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 EF75E142624; Thu, 11 Apr 2024 10:44:40 +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=1712832281; cv=none; b=DXMlm3wnd30q+0qyur3ZmOKdtyFrRdT+JmnaKZtZglLAbcRTZPZzegqWZ7ZSSfSyKuO3oWxxlmPdU1u96JGuqiwOkItILjVBqSs5O1fl5sbFYjaUaeSZZWopmyFRXFM+fGyuLo6c00t2aku11Kfaa4jLPliIhW3FppscRVduKOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832281; c=relaxed/simple; bh=s0gsO7fPJQAm68mE2j930uNN2HnMPwRoF/GMTxI8Yuo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t/Uvl0VkxJwa+Y0Pk5LEmJE9xMHMWvk2VNjXzPod53MgHvxOeUXZ697Xrwq3IT0mZGbTyq6T6qeYd0Flp1yep9kPfsmaSOnpw2NNmj50VE7kQytAQtkCAFd704QvcWRI3DWwjivIiW4cHiP778vAYzAIt0Y01Ga4b9xY94J9ELA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GW3IA6BR; 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="GW3IA6BR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 779AFC433C7; Thu, 11 Apr 2024 10:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712832280; bh=s0gsO7fPJQAm68mE2j930uNN2HnMPwRoF/GMTxI8Yuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GW3IA6BRI1a56XKxMefHBhFvL5Thto42Z0yM620IDF5RZ49wkqVKaY5MzfPVkAFos Hd++j/fN2a9Vpiv75pjcRK83H6pIq+32RnjYor45YTnxuvoEtlzaFDAaALfEB45BBr T6jS/PIk4gvNn9SZqLebqTEDnlbhkHImpr5qg6Ok= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vasiliy Kovalev , Kees Cook Subject: [PATCH 5.10 290/294] VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler() Date: Thu, 11 Apr 2024 11:57:33 +0200 Message-ID: <20240411095444.267137646@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095435.633465671@linuxfoundation.org> References: <20240411095435.633465671@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasiliy Kovalev commit e606e4b71798cc1df20e987dde2468e9527bd376 upstream. The changes are similar to those given in the commit 19b070fefd0d ("VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()"). Fix filling of the msg and msg_payload in dg_info struct, which prevents a possible "detected field-spanning write" of memcpy warning that is issued by the tracking mechanism __fortify_memcpy_chk. Signed-off-by: Vasiliy Kovalev Link: https://lore.kernel.org/r/20240219105315.76955-1-kovalev@altlinux.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/misc/vmw_vmci/vmci_datagram.c +++ b/drivers/misc/vmw_vmci/vmci_datagram.c @@ -378,7 +378,8 @@ int vmci_datagram_invoke_guest_handler(s dg_info->in_dg_host_queue = false; dg_info->entry = dst_entry; - memcpy(&dg_info->msg, dg, VMCI_DG_SIZE(dg)); + dg_info->msg = *dg; + memcpy(&dg_info->msg_payload, dg + 1, dg->payload_size); INIT_WORK(&dg_info->work, dg_delayed_dispatch); schedule_work(&dg_info->work);