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.
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: Michael Kelley <[email protected]>
--- drivers/hv/hv.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/hv/hv.c +6 -1
@@ -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 ; }
Signature · 1 line
1.7.1
Quoted 17 lines · On Wed, 17 May 2017 14:40:55 -0700 [email protected] wrote:
From: Michael Kelley <[email protected]>
Signed-off-by Michael Kelley <[email protected]>--- drivers/hv/hv.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)drivers/hv/hv.c +0
-1@@ -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);
drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id, · line 95
Quoted 10 lines
drivers/hv/hv.c +6
-0status =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 ; }
Since Subject line becomes the git log description, it is best practice to keep it short. On git commit man page:
Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description.
If you need to provide more description put it in the message body.
This looks like a bugfix that should be included in stable.
Quoted 39 lines · Stephen Hemminger
Quoted 17 lines · On Wed, 17 May 2017 14:40:55 -0700 [email protected] wrote:
From: Michael Kelley <[email protected]>
Signed-off-by Michael Kelley <[email protected]>--- drivers/hv/hv.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)drivers/hv/hv.c +0
-1@@ -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);drivers/hv/hv.c int hv_post_message(union hv_connection_id connection_id, · line 95
Quoted 10 lines
drivers/hv/hv.c +6
-0status =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 ; }Since Subject line becomes the git log description, it is best practice to keep it short. On git commit man page:
Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description.
If you need to provide more description put it in the message body.