lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Feb 2009 06:40:42 -0800 (PST)
From:	Parav Pandit <paravpandit@...oo.com>
To:	Linux kernel <linux-kernel@...r.kernel.org>
Subject: Suspected sock_sendmsg() with MSG_DONTWAIT can block bug.


Hi,
I am running kernel 2.6.23 from www.kernel.org.

Short quick question:
---------------------
If sock_sendmsg() is calls with MSG_DONTWAIT, it should send the packet without blocking the context or fail the call with error value.

Which means sock_sendmsg() with MSG_DONTWAIT can be called from soft-irq/ interrupt ctx.
Is that correct?

Assuming its correct, long question:
-----------------------------------

One function of my kernel module looks like

msg_hdr.flags = MSG_DONTWAIT;
spin_lock(lock)
....
sock_sendmsg(sock, msg_hdr, len);
spin_unlock(lock);

I am getting following warning,
BUG: sleeping function called from invalid context at net/core/sock.c:1586

Indicating it can sleep. Here is the back trace of sock_sendmsg() with MSG_DONTWAIT. Is this bug or expected behavior?

Feb 24 19:26:16 localhost kernel: BUG: sleeping function called from invalid context at net/core/sock.c:1586
Feb 24 19:26:16 localhost kernel: in_atomic():1, irqs_disabled():0
Feb 24 19:26:16 localhost kernel:  [<c06c4115>] lock_sock_nested+0x18/0x9e
Feb 24 19:26:16 localhost kernel:  [<c0432632>] local_bh_disable+0xa/0xb
Feb 24 19:26:16 localhost kernel:  [<c06c407c>] release_sock+0x13/0x94
Feb 24 19:26:16 localhost kernel:  [<c06f7afb>] tcp_sendmsg+0x15/0xa21
Feb 24 19:26:16 localhost kernel:  [<c04323b0>] irq_exit+0x50/0x72
Feb 24 19:26:16 localhost kernel:  [<c06c2379>] sock_sendmsg+0xd0/0xeb
Feb 24 19:26:16 localhost kernel:  [<c043eacc>] autoremove_wake_function+0x0/0x35
Feb 24 19:26:16 localhost kernel:  [<c0425e0d>] resched_task+0x3b/0x59
Feb 24 19:26:16 localhost kernel:  [<c0751efe>] _spin_unlock_irqrestore+0x1c/0x30
Feb 24 19:26:16 localhost kernel:  [<c0427c18>] try_to_wake_up+0x2e6/0x2f0
Feb 24 19:26:16 localhost kernel:  [<c043eae1>] autoremove_wake_function+0x15/0x35
Feb 24 19:26:16 localhost kernel:  [<c0424643>] __wake_up_common+0x32/0x55
Feb 24 19:26:16 localhost kernel:  [<f8f9b53e>] send+0xce/0x110 [test_driver]
Feb 24 19:26:16 localhost kernel:  [<f8f9bc16>] drv_tx+0xe6/0x110 [test_driver]
Feb 24 19:26:16 localhost kernel:  [<f8f9c07d>] drv_ctrl_msg+0x7d/0xb0 [test_driver]
Feb 24 19:26:16 localhost kernel:  [<c08be000>] __init_begin+0x0/0x10
Feb 24 19:26:16 localhost kernel:  [<f8fa64ad>] io_thread+0xed/0x1d0 [test_driver]
Feb 24 19:26:16 localhost kernel:  [<f8fa63c0>] io_thread+0x0/0x1d0 [test_driver]
Feb 24 19:26:16 localhost kernel:  [<c0405d47>] kernel_thread_helper+0x7/0x10

Regards,
Parav Pandit





      
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ