netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Shuo <shuo.a.liu@intel.com>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	linux-kernel@vger.kernel.org, yanmin_zhang@linux.intel.com,
	shuox.liu@gmail.com, Zhang Yanmin <yanmin.zhang@intel.com>,
	"He, Bo" <bo.he@intel.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	"open list:CAN NETWORK LAYER" <linux-can@vger.kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>
Subject: Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb
Date: Sat, 14 Jan 2017 11:43:30 +0800	[thread overview]
Message-ID: <20170114034330.GA30070@shuo-desktop.sh.intel.com> (raw)
In-Reply-To: <9e6817a0-65b3-ed16-4616-f8e55aee09c4@hartkopp.net>

On Thu 12.Jan'17 at 17:33:38 +0100, Oliver Hartkopp wrote:
>On 01/12/2017 02:01 PM, Eric Dumazet wrote:
>>On Thu, 2017-01-12 at 09:22 +0100, Oliver Hartkopp wrote:
>
>>>But my main concern is:
>>>
>>>The reason why can_rx_delete_receiver() was introduced was the need to
>>>remove a huge number of receivers with can_rx_unregister().
>>>
>>>When you call synchronize_rcu() after each receiver removal this would
>>>potentially lead to a big performance issue when e.g. closing CAN_RAW
>>>sockets with a high number of receivers.
>>>
>>>So the idea was to remove/unlink the receiver hlist_del_rcu(&r->list)
>>>and also kmem_cache_free(rcv_cache, r) by some rcu mechanism - so that
>>>all elements are cleaned up by rcu at a later point.
>>>
>>>Is it possible that the problems emerge due to hlist_del_rcu(&r->list)
>>>and you accidently fix it with your introduced synchronize_rcu()?
>>
>>I agree this patch does not fix the root cause.
>>
>>The main problem seems that the sockets themselves are not RCU
>>protected.
>>
>>If CAN uses RCU for delivery, then sockets should be freed only after
>>one RCU grace period.
>>
>>On recent kernels, following patch could help :
>>
>
>Thanks Eric!
>
>@Liu ShuoX: Can you check if Eric's suggestion fixes the issue in your 
>setup?
Sorry for late reply. I was OOO yesterday.
With Eric's hint, i just found his patch that "net: add SOCK_RCU_FREE
socket flag" in the latest kernel. With backporting this one plus Eric's
following patch, it fixs my failure.

Thanks Eric and Oliver!

Shuo
>
>Best regards,
>Oliver

  reply	other threads:[~2017-01-14  3:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  6:33 [PATCH] can: Fix kernel panic at security_sock_rcv_skb Liu ShuoX
2017-01-12  8:22 ` Oliver Hartkopp
2017-01-12 13:01   ` Eric Dumazet
2017-01-12 16:33     ` Oliver Hartkopp
2017-01-14  3:43       ` Liu Shuo [this message]
2017-01-14 13:53         ` Oliver Hartkopp
2017-01-14 17:30           ` Eric Dumazet
2017-01-27 16:11     ` [PATCH v3] " Eric Dumazet
2017-01-27 20:02       ` Oliver Hartkopp
2017-01-29 23:34       ` David Miller
2017-02-10  8:28         ` Oliver Hartkopp
2017-02-10 15:16           ` David Miller
2017-02-10 17:50             ` Oliver Hartkopp
  -- strict thread matches above, loose matches on Subject: below --
2017-01-12 22:40 [PATCH] " william.c.roberts
2017-01-12 23:10 ` Eric Dumazet
2017-01-27 20:46 pull-request: can 2017-01-27 Marc Kleine-Budde
2017-01-27 20:46 ` [PATCH] can: Fix kernel panic at security_sock_rcv_skb Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170114034330.GA30070@shuo-desktop.sh.intel.com \
    --to=shuo.a.liu@intel.com \
    --cc=bo.he@intel.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=shuox.liu@gmail.com \
    --cc=socketcan@hartkopp.net \
    --cc=yanmin.zhang@intel.com \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).