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 576182EAE5; Thu, 11 Apr 2024 10:52:12 +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=1712832732; cv=none; b=C8CzOkqa3T6M2rgVbKQJHvlatcXw3cYtPFfpm5zyvyGp2zkaQ+ppUQVZGbaFUOr6nCbRtqh3umtcFD0b6StzGG7HB8K6yizKFV4bsF8iEvXfZJXeyyq8SxbhlZleq+9lDiYGqRKmUDJqQCyAlKpZ75SAVAvDsBVxfSDFwhjjdw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832732; c=relaxed/simple; bh=tFEFgNpfP2pDrh7H/Gx9a0f+3gaEhafOfGeccai/VGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m/LXne0qwvdu20jkn0RgRgqgod+bBlWNA6ZfxicbgWFZFU7u3v7KUdhJPUmpDnf/W88j0sHEwXss3MDqWyZvPqqb4BuQDvmfy960yNKifkoumxs5zrkNOn6KIBr+ndSuwRGIV2rXOKv24jmOn7bhmSrTfJMhp4hkYHn12pKine8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aWqmv+12; 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="aWqmv+12" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D26F1C433C7; Thu, 11 Apr 2024 10:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712832732; bh=tFEFgNpfP2pDrh7H/Gx9a0f+3gaEhafOfGeccai/VGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWqmv+12iGGwj0Tg8+BbKLMWPSat8YD66aY2d9MFPq+xngTBwEelT0KH4XjmjECMd WdSlaMHdRin/Ze/CdbrtG/iqzsF5FNg2j8Us1DJoRRLjGbtnFv7lAoWGyPKEN5IaEj WWkVGjs4riUr9DYm1UaDggcRfZpelUUmgC7rtIYI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vasiliy Kovalev , Kees Cook Subject: [PATCH 5.15 57/57] VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler() Date: Thu, 11 Apr 2024 11:58:05 +0200 Message-ID: <20240411095409.722366642@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095407.982258070@linuxfoundation.org> References: <20240411095407.982258070@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.15-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);