public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* suspicious RCU usage in security/selinux/netport.c:127
@ 2011-11-07 16:25 Dave Jones
  2011-11-07 16:29 ` Eric Paris
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jones @ 2011-11-07 16:25 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Stephen Smalley, James Morris, Eric Paris

I think I reported this a while ago. Turns out it's still a problem.
This patch I think made the warning go away, but it might be a bit too 'big hammer' ?

	Dave

===============================
[ INFO: suspicious RCU usage. ]
-------------------------------
security/selinux/netport.c:127 suspicious rcu_dereference_check() usage!

other info that might help us debug this:


rcu_scheduler_active = 1, debug_locks = 0
1 lock held by named/1687:
 #0:  (sel_netport_lock){+.....}, at: [<ffffffff812e3799>] sel_netport_sid+0xd9/0x260

stack backtrace:
Pid: 1687, comm: named Not tainted 3.1.0+ #1
Call Trace:
 [<ffffffff810bcc37>] lockdep_rcu_suspicious+0xd7/0xe0
 [<ffffffff812e3917>] sel_netport_sid+0x257/0x260
 [<ffffffff812e36c0>] ? sel_netport_find+0xe0/0xe0
 [<ffffffff812dd8ba>] selinux_socket_bind+0x22a/0x300
 [<ffffffff8116ceb3>] ? might_fault+0x53/0xb0
 [<ffffffff8116cefc>] ? might_fault+0x9c/0xb0
 [<ffffffff8116ceb3>] ? might_fault+0x53/0xb0
 [<ffffffff812d3fb6>] security_socket_bind+0x16/0x20
 [<ffffffff81539b4a>] sys_bind+0x7a/0x100
 [<ffffffff816572ba>] ? sysret_check+0x2e/0x69
 [<ffffffff810c18dd>] ? trace_hardirqs_on_caller+0x11d/0x1b0
 [<ffffffff8133c65e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff81657282>] system_call_fastpath+0x16/0x1b

diff --git a/security/selinux/netport.c b/security/selinux/netport.c
index 0b62bd1..69f6928 100644
--- a/security/selinux/netport.c
+++ b/security/selinux/netport.c
@@ -119,6 +119,7 @@ static void sel_netport_insert(struct sel_netport *port)
 	/* we need to impose a limit on the growth of the hash table so check
 	 * this bucket to make sure it is within the specified bounds */
 	idx = sel_netport_hashfn(port->psec.port);
+	rcu_read_lock();
 	list_add_rcu(&port->list, &sel_netport_hash[idx].list);
 	if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
 		struct sel_netport *tail;
@@ -129,6 +130,7 @@ static void sel_netport_insert(struct sel_netport *port)
 		kfree_rcu(tail, rcu);
 	} else
 		sel_netport_hash[idx].size++;
+	rcu_read_unlock();
 }
 
 /**

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: suspicious RCU usage in security/selinux/netport.c:127
  2011-11-07 16:25 suspicious RCU usage in security/selinux/netport.c:127 Dave Jones
@ 2011-11-07 16:29 ` Eric Paris
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Paris @ 2011-11-07 16:29 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, Stephen Smalley, James Morris

On Mon, 2011-11-07 at 11:25 -0500, Dave Jones wrote:
> I think I reported this a while ago. Turns out it's still a problem.
> This patch I think made the warning go away, but it might be a bit too 'big hammer' ?

http://patchwork.ozlabs.org/patch/117821/

I thought it was already picked up.  I'll take care of it today.

-Eric


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-07 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 16:25 suspicious RCU usage in security/selinux/netport.c:127 Dave Jones
2011-11-07 16:29 ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox