Commit e606e4b7 authored by Vasiliy Kovalev's avatar Vasiliy Kovalev Committed by Kees Cook

VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()

The changes are similar to those given in the commit 19b070fe
("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: default avatarVasiliy Kovalev <kovalev@altlinux.org>
Link: https://lore.kernel.org/r/20240219105315.76955-1-kovalev@altlinux.orgSigned-off-by: default avatarKees Cook <keescook@chromium.org>
parent f0b7f8ad
...@@ -378,7 +378,8 @@ int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg) ...@@ -378,7 +378,8 @@ int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg)
dg_info->in_dg_host_queue = false; dg_info->in_dg_host_queue = false;
dg_info->entry = dst_entry; 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); INIT_WORK(&dg_info->work, dg_delayed_dispatch);
schedule_work(&dg_info->work); schedule_work(&dg_info->work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment