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


Groups > linux.kernel > #1643657

[PATCH 1/1] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page 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.

From mikelley@exchange.microsoft.com
Newsgroups linux.kernel
Subject [PATCH 1/1] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page 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.
Date 2017-05-18 00:00 +0200
Message-ID <tIf97-cH-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Michael Kelley <mikelley@microsoft.com>

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
 drivers/hv/hv.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 12e7bae..47ed538 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -82,9 +82,14 @@ int hv_post_message(union hv_connection_id connection_id,
 	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;
 }
-- 
1.7.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page 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. mikelley@exchange.microsoft.com - 2017-05-18 00:00 +0200
  Re: [PATCH 1/1] Drivers: hv: vmbus: Close timing hole that can  corrupt per-cpu page 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. Stephen Hemminger <stephen@networkplumber.org> - 2017-05-18 00:10 +0200
    Re: [PATCH 1/1] Drivers: hv: vmbus: Close timing hole that can  corrupt per-cpu page 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. "Joshua R. Poulson" <jrp@pun.org> - 2017-05-18 00:10 +0200

csiph-web