[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BLUPR03MB1410219440D5A91E98E7D0DFBF4B0@BLUPR03MB1410.namprd03.prod.outlook.com>
Date: Fri, 20 May 2016 15:30:20 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Dexuan Cui <decui@...rosoft.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"driverdev-devel@...uxdriverproject.org"
<driverdev-devel@...uxdriverproject.org>,
"olaf@...fle.de" <olaf@...fle.de>,
"apw@...onical.com" <apw@...onical.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
KY Srinivasan <kys@...rosoft.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
Rolf Neugebauer <rolf.neugebauer@...ker.com>,
Dave Scott <dave.scott@...ker.com>
CC: Haiyang Zhang <haiyangz@...rosoft.com>
Subject: RE: [PATCH v2] Drivers: hv: vmbus: fix the race when querying &
updating the percpu list
> From: devel [mailto:driverdev-devel-bounces@...uxdriverproject.org] On
> Behalf Of Dexuan Cui
> Sent: Wednesday, May 18, 2016 11:44
> To: gregkh@...uxfoundation.org; linux-kernel@...r.kernel.org; driverdev-
> devel@...uxdriverproject.org; olaf@...fle.de; apw@...onical.com;
> jasowang@...hat.com; KY Srinivasan <kys@...rosoft.com>;
> vkuznets@...hat.com
> Cc: Haiyang Zhang <haiyangz@...rosoft.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@...ker.com>
> Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
> Signed-off-by: Dexuan Cui <decui@...rosoft.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
Powered by blists - more mailing lists