VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
Subsystems (2)
PATCH 1/1 VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
From: Vasiliy Kovalev <[email protected]>
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.
--- drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_datagram.c +2 -1
@@ -378,7 +378,8 @@ int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg) 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);
Signature · 1 line
2.33.8
Kees Cook
AppliedQuoted 8 lines · On Mon, 19 Feb 2024 13:53:15 +0300, [email protected] wrote:
The changes are similar to those given in the commit
19b070fefd0d("VMCI: Fixmemcpy()run-time warning indg_dispatch_as_host()").Fix filling of the msg and
msg_payloadindg_infostruct, which prevents a possible "detected field-spanning write" of memcpy warning that is issued by the tracking mechanism__fortify_memcpy_chk.[...]
Since I ended up carrying the other fix, I can carry this one too. :)
Applied to for-next/hardening, thanks!
[1/1] VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
https://git.kernel.org/kees/c/1ce15647a1aa
Take care,
Signature · 1 line
Kees Cook