lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240219105315.76955-1-kovalev@altlinux.org>
Date: Mon, 19 Feb 2024 13:53:15 +0300
From: kovalev@...linux.org
To: linux-kernel@...r.kernel.org
Cc: keescook@...omium.org,
	gregkh@...uxfoundation.org,
	bryantan@...are.com,
	vdasa@...are.com,
	pv-drivers@...are.com,
	arnd@...db.de,
	harshit.m.mogalapalli@...cle.com,
	nickel@...linux.org,
	oficerovas@...linux.org,
	dutyrok@...linux.org,
	kovalev@...linux.org
Subject: [PATCH] VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()

From: Vasiliy Kovalev <kovalev@...linux.org>

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 <kovalev@...linux.org>
---
 drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
index d1d8224c8800c4..a0ad1f3a69f7e9 100644
--- 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(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);
-- 
2.33.8


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ