Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1691336 > unrolled thread

[PATCH 4.11 67/88] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-07-19 12:20 +0200
Last post2017-07-19 12:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.11 67/88] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-19 12:20 +0200

#1691336 — [PATCH 4.11 67/88] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-07-19 12:20 +0200
Subject[PATCH 4.11 67/88] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page
Message-ID<u4Ufh-79T-59@gated-at.bofh.it>
4.11-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Kelley <mikelley@microsoft.com>

commit 13b9abfc92be7c4454bff912021b9f835dea6e15 upstream.

Extend the disabling of preemption to include the hypercall so that
another thread can't get the CPU and corrupt the per-cpu page used
for hypercall arguments.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hv/hv.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -82,10 +82,15 @@ int hv_post_message(union hv_connection_
 	aligned_msg->message_type = message_type;
 	aligned_msg->payload_size = payload_size;
 	memcpy((void *)aligned_msg->payload, payload, payload_size);
-	put_cpu_ptr(hv_cpu);
 
 	status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL);
 
+	/* Preemption must remain disabled until after the hypercall
+	 * so some other thread can't get scheduled onto this cpu and
+	 * corrupt the per-cpu post_msg_page
+	 */
+	put_cpu_ptr(hv_cpu);
+
 	return status & 0xFFFF;
 }
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web