All of lore.kernel.org
 help / color / mirror / Atom feed
* selinux networking: sleeping functin called from invalid context in 2.6.20-rc[12]
@ 2006-12-24 21:21 Adam J. Richter
  2006-12-25  0:15 ` Parag Warudkar
  2006-12-25  0:25 ` Andrew Morton
  0 siblings, 2 replies; 11+ messages in thread
From: Adam J. Richter @ 2006-12-24 21:21 UTC (permalink / raw)
  To: linux-kernel

	Under 2.6.20-rc1 and 2.6.20-rc2, I get the following complaint
for several network programs running on my system:

[  156.381868] BUG: sleeping function called from invalid context at net/core/sock.c:1523
[  156.381876] in_atomic():1, irqs_disabled():0
[  156.381881] no locks held by kio_http/9693.
[  156.381886]  [<c01057a2>] show_trace_log_lvl+0x1a/0x2f
[  156.381900]  [<c0105dab>] show_trace+0x12/0x14
[  156.381908]  [<c0105e48>] dump_stack+0x16/0x18
[  156.381917]  [<c011e30f>] __might_sleep+0xe5/0xeb
[  156.381926]  [<c025942a>] lock_sock_nested+0x1d/0xc4
[  156.381937]  [<c01cc570>] selinux_netlbl_inode_permission+0x5a/0x8e
[  156.381946]  [<c01c2505>] selinux_file_permission+0x96/0x9b
[  156.381954]  [<c0175a0a>] vfs_write+0x8d/0x167
[  156.381962]  [<c017605a>] sys_write+0x3f/0x63
[  156.381971]  [<c01040c0>] syscall_call+0x7/0xb
[  156.381980]  =======================

	I have 35 of these messages is my console log at the moment.
The only difference that I've noticed between the messages is
that they are for variety of processes: most for tor, xntpd, sendmail,
procmail.  The processes get to this point by sys_write, sys_send, or
sys_sendto (procmail was doing a sys_sendto, so it was also doing something
related to networking, even though it is not a program one normally
would think of as doing any networking system calls).

	My system seems to work OK even with these warning messages.
I can debug it futher.  I just figure I should report it now, because
I may have done everyone a disservice by putting off reporting it in
rc1 in the hopes of finding time to debug it.

Adam Richter

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: selinux networking: sleeping functin called from invalid  context in 2.6.20-rc[12]
@ 2006-12-26  5:30 Paul Moore
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Moore @ 2006-12-26  5:30 UTC (permalink / raw)
  To: akpm; +Cc: adam, linux-kernel, netdev

-----Original Message-----
From: Andrew Morton <akpm@osdl.org>
Date: Sunday, Dec 24, 2006 7:25 pm
Subject: Re: selinux networking: sleeping functin called from invalid  context in 2.6.20-rc[12]

On Mon, 25 Dec 2006 05:21:24 +0800
>"Adam J. Richter" <adam@yggdrasil.com> wrote:
>
>> 	Under 2.6.20-rc1 and 2.6.20-rc2, I get the following complaint
> for several network programs running on my system:
> 
> [  156.381868] BUG: sleeping function called from invalid context at net/core/sock.c:1523
> [  156.381876] in_atomic():1, irqs_disabled():0
> [  156.381881] no locks held by kio_http/9693.
> [  156.381886]  [<c01057a2>] show_trace_log_lvl+0x1a/0x2f
> [  156.381900]  [<c0105dab>] show_trace+0x12/0x14
> [  156.381908]  [<c0105e48>] dump_stack+0x16/0x18
> [  156.381917]  [<c011e30f>] __might_sleep+0xe5/0xeb
> [  156.381926]  [<c025942a>] lock_sock_nested+0x1d/0xc4
> [  156.381937]  [<c01cc570>] selinux_netlbl_inode_permission+0x5a/0x8e
> [  156.381946]  [<c01c2505>] selinux_file_permission+0x96/0x9b
> [  156.381954]  [<c0175a0a>] vfs_write+0x8d/0x167
> [  156.381962]  [<c017605a>] sys_write+0x3f/0x63
> [  156.381971]  [<c01040c0>] syscall_call+0x7/0xb
> [  156.381980]  =======================
> 
>
>There's a glaring bug in selinux_netlbl_inode_permission() - taking lock_sock() inside rcu_read_lock().
>
>I would again draw attention to Documentation/SubmitChecklist.  In
>particular please always always always enable all kernel debugging options when developing and testing new kernel code.  And everything else in that file, too.
>

I apologize for the mistake - I'm still trying to get a firm grasp on some of the finer points of Linux kernel development and I obviously missed something here.  Unfortunately, due to the holiday I won't be able to write/test/submit a patch until after the first of the year but I promise to do so as soon as I am able.

. paul moore
. linux security @ hp


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: selinux networking: sleeping functin called from invalid context in 2.6.20-rc[12]
@ 2007-01-04 11:32 Adam J. Richter
  0 siblings, 0 replies; 11+ messages in thread
From: Adam J. Richter @ 2007-01-04 11:32 UTC (permalink / raw)
  To: paul.moore; +Cc: akpm, davem, mingo, netdev

On Wed, 3 Jan 2007 15:46:31 -0500, Paul Moore wrote:
>This makes me believe that Ingo's patch (which I see is now in Linus' and 
>Andrew's trees) is the way to go and not the lock re-order approach in Adam's 
>patch.  I'm going to continue to look into this, almost more for my own 
>education than anything else, but I thought I would mention this lock 
>dependency message as it seemed relevant to the discussion.

	Both Ingo's patch and mine preserved the lock order, in a
sense: take the read_read_lock first, and avoid locking the socket if
possible.  Ingo's patch avoided unlocking and relocking by using some
facilities that I must admit my prior ignorance of.  So, I agree that
if both patches are "correct", then Ingo's is better.

	I have been running Ingo's patch for the past ~1.5 days, and
as far as I can tell it seems to be no worse than mine.

	The reason for such a guarded description as "no worse than
mine" is that I have been experiencing occasoinal system hangs that
started in 2.6.20-rc1 without any patch, which I have observed in
2.6.20-rc3 with my patch, and also 2.6.20-rc3 with Ingo's patch.
These hangs may be completly unrelated to this selinux issue though
and it may be days before get around to studying it more carefully, so
I'm happy to see Ingo's patch integrated now.

Adam

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

end of thread, other threads:[~2007-01-04 11:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-24 21:21 selinux networking: sleeping functin called from invalid context in 2.6.20-rc[12] Adam J. Richter
2006-12-25  0:15 ` Parag Warudkar
2006-12-25  0:25 ` Andrew Morton
2007-01-02  7:58   ` Adam J. Richter
2007-01-02 21:25     ` Paul Moore
2007-01-02 23:37       ` David Miller
2007-01-03 20:46         ` Paul Moore
2007-01-02 20:09   ` [patch] selinux: fix selinux_netlbl_inode_permission() locking Ingo Molnar
2007-01-02 21:14   ` selinux networking: sleeping functin called from invalid context in 2.6.20-rc[12] Paul Moore
  -- strict thread matches above, loose matches on Subject: below --
2006-12-26  5:30 Paul Moore
2007-01-04 11:32 Adam J. Richter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.