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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon,  3 Jun 2024 22:09:29 -0700
From: mhkelley58@...il.com
To: kys@...rosoft.com,
	haiyangz@...rosoft.com,
	wei.liu@...nel.org,
	decui@...rosoft.com,
	tglx@...utronix.de,
	mingo@...hat.com,
	bp@...en8.de,
	dave.hansen@...ux.intel.com,
	x86@...nel.org,
	hpa@...or.com,
	lpieralisi@...nel.org,
	kw@...ux.com,
	robh@...nel.org,
	bhelgaas@...gle.com,
	James.Bottomley@...senPartnership.com,
	martin.petersen@...cle.com,
	arnd@...db.de,
	linux-hyperv@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org,
	linux-scsi@...r.kernel.org,
	linux-arch@...r.kernel.org
Cc: maz@...nel.org,
	den@...inux.co.jp,
	jgowans@...zon.com,
	dawei.li@...ngroup.cn
Subject: [RFC 01/12] Drivers: hv: vmbus: Drop unsupported VMBus devices earlier

From: Michael Kelley <mhklinux@...look.com>

Because Hyper-V doesn't know ahead-of-time what operating system will be
running in a guest VM, it may offer to Linux guests VMBus devices that are
intended for use only in Windows guests. Currently in Linux, VMBus
channels are created for these devices, and they are processed by
vmbus_device_register(). While nothing further happens because no matching
driver is found, the channel continues to exist.

To avoid having the spurious channel, drop such devices immediately in
vmbus_onoffer(), based on identifying the device in the
vmbus_unsupported_devs table. If Hyper-V should issue a rescind request
for the device, no matching channel will be found and the rescind will
also be ignored.

Since unsupported devices are dropped early, the check for unsupported
devices in hv_get_dev_type() is redundant. Remove it.

Signed-off-by: Michael Kelley <mhklinux@...look.com>
---
 drivers/hv/channel_mgmt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 3c6011a48dab..a216a0aede73 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -203,7 +203,7 @@ static u16 hv_get_dev_type(const struct vmbus_channel *channel)
 	const guid_t *guid = &channel->offermsg.offer.if_type;
 	u16 i;
 
-	if (is_hvsock_channel(channel) || is_unsupported_vmbus_devs(guid))
+	if (is_hvsock_channel(channel))
 		return HV_UNKNOWN;
 
 	for (i = HV_IDE; i < HV_UNKNOWN; i++) {
@@ -1036,6 +1036,16 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
 
 	trace_vmbus_onoffer(offer);
 
+	/*
+	 * Hyper-V may offer pseudo-devices with functionality intended for
+	 * Windows guests. Silently ignore them. There's no value in
+	 * cluttering dmesg with error messages.
+	 */
+	if (is_unsupported_vmbus_devs(&offer->offer.if_type)) {
+		atomic_dec(&vmbus_connection.offer_in_progress);
+		return;
+	}
+
 	if (!vmbus_is_valid_offer(offer)) {
 		pr_err_ratelimited("Invalid offer %d from the host supporting isolation\n",
 				   offer->child_relid);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ