From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next 2/3] netlink: Convert netlink_lookup() to use RCU protected hash table Date: Mon, 04 Aug 2014 19:58:41 -0700 (PDT) Message-ID: <20140804.195841.536725238366145203.davem@davemloft.net> References: <53E03D0B.3000208@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org, nikolay-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org, walpole-sKt6ljEC1JY3uPMLIKxrzw@public.gmane.org To: sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org Return-path: In-Reply-To: <53E03D0B.3000208-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Sender: "dev" List-Id: netfilter-devel.vger.kernel.org From: Sasha Levin Date: Mon, 04 Aug 2014 22:10:19 -0400 > On 08/02/2014 05:47 AM, Thomas Graf wrote: >> static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) >> - __acquires(nl_table_lock) >> { >> - read_lock(&nl_table_lock); >> + rcu_read_lock(); >> return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; >> } > > I'm not sure how you expect this code to work. You're replacing a local lock > with a RCU critical section. Imagine you're doing spin_lock() and just going > back to userspace. > > It's quite easy to trigger this issue: I think he expected the end of the seq sequence to drop the RCU lock, via netlink_seq_stop().