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 0F37D101DE; Thu, 11 Apr 2024 10:30:07 +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=1712831407; cv=none; b=Qrc+Y2GO7MUPInOsRhvlT6Kn7bzTc7mJArWggR4pNB1JVN+RkFTxTFUmhTISoeMY+oFyP7rosuLvVKWqjEHZf6xZxplwx2ZfCq3mRfQu9ZC8FxwkeXp9pAHEhHAzLTL7iMc/bKInK3xXJU09qRO3rn0YorDUkVDplEHO1TM0BPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712831407; c=relaxed/simple; bh=qxIVsdppQoup3CSUG4VsoG3JrthiHNbPym6rXpr4Ugg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZNcYmcF91/WN6H+Zn5cApC8NTB8EQZPGzSTFnDxc756neVxkiTzJq3gQwwneXSZxkSjulTnW+5b05o2CHD+iEGnrj2nZMXcer3NSol1vgLyxmOlKIimA79CKCcpoIBI48Ca3K4NapvcOGU0VdNupl8Hu6esFjeBYhjEn1FcpdLA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ijoSde9U; 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="ijoSde9U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AD7AC43390; Thu, 11 Apr 2024 10:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712831406; bh=qxIVsdppQoup3CSUG4VsoG3JrthiHNbPym6rXpr4Ugg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijoSde9Uvb2ekhn34pYc1oSXjs41eN2Qvkp9QmKqFjOfNJGcMCqhUvhm+iWrXg0Xh uFNzu8yIHV0y190Vpj/kZduZYIU0Q3uuDWAsCGTOE5b2cEOlHizbnDafwk0ybmwdxv Icq2tTFOKXo6DgvZ2F4D0kwXQ1fPDmdJvghFyM14= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vasiliy Kovalev , Kees Cook Subject: [PATCH 6.6 113/114] VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler() Date: Thu, 11 Apr 2024 11:57:20 +0200 Message-ID: <20240411095420.303348032@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095416.853744210@linuxfoundation.org> References: <20240411095416.853744210@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 6.6-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);