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


Groups > linux.kernel > #1404552

RE: [PATCH v2] Drivers: hv: vmbus: fix the race when querying & updating the percpu list

From Dexuan Cui <decui@microsoft.com>
Newsgroups linux.kernel
Subject RE: [PATCH v2] Drivers: hv: vmbus: fix the race when querying & updating the percpu list
Date 2016-05-20 17:40 +0200
Message-ID <rAUGS-7fU-19@gated-at.bofh.it> (permalink)
References <rzZ5T-4by-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On
> Behalf Of Dexuan Cui
> Sent: Wednesday, May 18, 2016 11:44
> To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com; KY Srinivasan <kys@microsoft.com>;
> vkuznets@redhat.com
> Cc: Haiyang Zhang <haiyangz@microsoft.com>
> Subject: [PATCH v2] Drivers: hv: vmbus: fix the race when querying &
> updating the percpu list
> 
> There is a rare race when we remove an entry from the global list
> hv_context.percpu_list[cpu] in hv_process_channel_removal() ->
> percpu_channel_deq() -> list_del(): at this time, if vmbus_on_event() ->
> process_chn_event() -> pcpu_relid2channel() is trying to query the list,
> we can get the general protection fault:
> 
> general protection fault: 0000 [#1] SMP
> ...
> RIP: 0010:[<ffffffff81461b6b>]  [<ffffffff81461b6b>]
> vmbus_on_event+0xc4/0x149
> 
> Similarly, we also have the issue in the code path: vmbus_process_offer() ->
> percpu_channel_enq().
> 
> We can resolve the issue by disabling the tasklet when updating the list.
> 
> Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
> 
> v2: added tasklet_schedule() after tasklet_enable(). Thanks, Vitaly!

Please ignore the patch for now.

I found an issue with the patch:  after I moved percpu_channel_deq()
from  hv_process_channel_removal() to vmbus_close_internal(), the
channel couldn't be removed from the per-cpu list, if the channel state
was not CHANNEL_OPENED_STATE.

I'll have to think about this and fix the issue in the next version.

Thanks,
-- Dexuan

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


Thread

[PATCH v2] Drivers: hv: vmbus: fix the race when querying & updating the percpu list Dexuan Cui <decui@microsoft.com> - 2016-05-18 04:10 +0200
  RE: [PATCH v2] Drivers: hv: vmbus: fix the race when querying &  updating the percpu list Dexuan Cui <decui@microsoft.com> - 2016-05-20 17:40 +0200

csiph-web