Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932506Ab2HFTKz (ORCPT ); Mon, 6 Aug 2012 15:10:55 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:39345 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932380Ab2HFTKy (ORCPT ); Mon, 6 Aug 2012 15:10:54 -0400 Date: Mon, 6 Aug 2012 12:09:30 -0700 From: "Paul E. McKenney" To: Dave Jones , Linux Kernel , eparis@redhat.com, paul@paul-moore.com, Andrew Morton , Linus Torvalds Subject: Re: Fix sel_netnode_insert suspicious rcu dereference. Message-ID: <20120806190930.GH2401@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20120605051238.GA30614@redhat.com> <20120806164914.GA25940@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120806164914.GA25940@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12080619-1780-0000-0000-00000817C365 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000290; HX=3.00000194; KW=3.00000007; PH=3.00000001; SC=3.00000006; SDB=6.00163061; UDB=6.00036882; UTC=2012-08-06 19:10:43 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3301 Lines: 84 On Mon, Aug 06, 2012 at 12:49:14PM -0400, Dave Jones wrote: > On Tue, Jun 05, 2012 at 01:12:39AM -0400, Dave Jones wrote: > > I reported this a year ago (https://lkml.org/lkml/2011/4/20/308). > > It's still a problem apparently ... > > And another two months pass in silence. > > This is happening to other people too. > https://bugzilla.redhat.com/show_bug.cgi?id=846037 > > Can someone please apply this patch, or at least point out what's wrong with it ? Feel free to add: Reviewed-by: Paul E. McKenney in case that helps. Thanx, Paul > Dave > > > > =============================== > > [ INFO: suspicious RCU usage. ] > > 3.5.0-rc1+ #63 Not tainted > > ------------------------------- > > security/selinux/netnode.c:178 suspicious rcu_dereference_check() usage! > > > > other info that might help us debug this: > > > > > > rcu_scheduler_active = 1, debug_locks = 0 > > 1 lock held by trinity-child1/8750: > > #0: (sel_netnode_lock){+.....}, at: [] sel_netnode_sid+0x16a/0x3e0 > > > > stack backtrace: > > Pid: 8750, comm: trinity-child1 Not tainted 3.5.0-rc1+ #63 > > Call Trace: > > [] lockdep_rcu_suspicious+0xfd/0x130 > > [] sel_netnode_sid+0x3b1/0x3e0 > > [] ? sel_netnode_find+0x1a0/0x1a0 > > [] selinux_socket_bind+0xf6/0x2c0 > > [] ? trace_hardirqs_off+0xd/0x10 > > [] ? lock_release_holdtime.part.9+0x15/0x1a0 > > [] ? lock_hrtimer_base+0x31/0x60 > > [] security_socket_bind+0x16/0x20 > > [] sys_bind+0x7a/0x100 > > [] ? sysret_check+0x22/0x5d > > [] ? trace_hardirqs_on_caller+0x10d/0x1a0 > > [] ? trace_hardirqs_on_thunk+0x3a/0x3f > > [] system_call_fastpath+0x16/0x1b > > > > This patch below does what Paul McKenney suggested in the previous thread. > > > > Signed-off-by: Dave Jones > > > > diff --git a/security/selinux/netnode.c b/security/selinux/netnode.c > > index 28f911c..c5454c0 100644 > > --- a/security/selinux/netnode.c > > +++ b/security/selinux/netnode.c > > @@ -174,7 +174,8 @@ static void sel_netnode_insert(struct sel_netnode *node) > > if (sel_netnode_hash[idx].size == SEL_NETNODE_HASH_BKT_LIMIT) { > > struct sel_netnode *tail; > > tail = list_entry( > > - rcu_dereference(sel_netnode_hash[idx].list.prev), > > + rcu_dereference_protected(sel_netnode_hash[idx].list.prev, > > + lockdep_is_held(&sel_netnode_lock)), > > struct sel_netnode, list); > > list_del_rcu(&tail->list); > > kfree_rcu(tail, rcu); > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > Please read the FAQ at http://www.tux.org/lkml/ > ---end quoted text--- > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/