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>] [day] [month] [year] [list]
Message-Id: <1436194063-27996-1-git-send-email-decui@microsoft.com>
Date:	Mon,  6 Jul 2015 07:47:43 -0700
From:	Dexuan Cui <decui@...rosoft.com>
To:	gregkh@...uxfoundation.org, davem@...emloft.net,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	driverdev-devel@...uxdriverproject.org, olaf@...fle.de,
	apw@...onical.com, jasowang@...hat.com, kys@...rosoft.com,
	haiyangz@...rosoft.com
Subject: [PATCH 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running

In the SMP guest case, when the per-channel callback hvsock_events() is
running on virtual CPU A, if the guest tries to close the connection on
virtual CPU B: we invoke vmbus_close() -> vmbus_close_internal(),
then we can have trouble: on B, vmbus_close_internal() will send IPI
reset_channel_cb() to A, trying to set channel->onchannel_callbackto NULL;
on A, if the IPI handler happens between
"if (channel->onchannel_callback != NULL)" and invoking
channel->onchannel_callback, we'll invoke a function pointer of NULL.

This is why the patch is necessary.

Signed-off-by: Dexuan Cui <decui@...rosoft.com>
---
 drivers/hv/connection.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 4fc2e88..4766fd8 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -319,6 +319,9 @@ static void process_chn_event(u32 relid)
 	void *arg;
 	bool read_state;
 	u32 bytes_to_read;
+	bool is_hvsock = false;
+
+	local_irq_disable();
 
 	/*
 	 * Find the channel based on this relid and invokes the
@@ -327,7 +330,11 @@ static void process_chn_event(u32 relid)
 	channel = pcpu_relid2channel(relid);
 
 	if (!channel)
-		return;
+		goto out;
+
+	is_hvsock = is_hvsock_channel(channel);
+	if (!is_hvsock)
+		local_irq_enable();
 
 	/*
 	 * A channel once created is persistent even when there
@@ -363,6 +370,12 @@ static void process_chn_event(u32 relid)
 				bytes_to_read = 0;
 		} while (read_state && (bytes_to_read != 0));
 	}
+
+	/* local_irq_enable() is alredy invoked above */
+	if (!is_hvsock)
+		return;
+out:
+	local_irq_enable();
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ