[openbeosnetteam] panic when creating socket of unknown type
- From: Romain <romain.haiku@xxxxxxxxxxx>
- To: Haiku network <openbeosnetteam@xxxxxxxxxxxxx>
- Date: Wed, 15 Apr 2009 23:33:18 +0200
Hello,
This list may be more accurate for my issue since I had no answer on the
devel mailing-list.
While compiling curl, I felt on a kernel panic caused by this program (from
autoconf):
---------------
main()
{
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
exit(1);
else
exit(0);
}
--------------
This compiles fines, but generates a panic when run:
PANIC: ASSERT FAILED (headers/private/kernel/util/DoublyLinkedList.h:467):
fFirst != __null && fLast != __null && (fFirst != fLast ||
Welcome to Kernel Debugging Land...
On the backtrace I can see that this comes from the net_socket_private
destructor (in net_socket.cpp), on the "sSocketList.Remove" call. This is
due to the fact that the "sSocketList.Add" was never done. There are 2
places where the Add is done but their location brings an issue because if
the "get_domain_protocols" call fail in "socket_create" we will always fall
in this issue.
I tried to move the Add call to the net_socket_private constructor, and
then I felt in the problem of my previous email (see bellow).
I can try to provide a patch, but I am afraid that I will do bad things
without help since two points are not clear to me:
- Is it ok to add all sockets in sSocketList as soon as they are created
(this impacts socket_get_next_stats)?
- Is it ok to load the net_socket module as soon as the stack is created
(It seems this was supposed to be done automatically only when needed) ?
Thanks,
Romain.
-------- Original Message --------
Subject: Load/Unload of net_socket module
Date: Sun, 12 Apr 2009 23:59:53 +0200
From: Romain <romain.haiku@xxxxxxxxxxx>
To: Haiku development <haiku-development@xxxxxxxxxxxxx>
Reply-To: romain.haiku@xxxxxxxxxxx
I am currently looking at a crash in the netstack that made me look at
calls done at boot time. I saw a few things but something seems really
strange to me. It seems that the net_socket module is not being loaded when
the stack is loaded, but when some specific calls are done
(get_domain_protocols, and get_domain_datalink protocols for example). On
the other way the net_stack_interface module is loaded when the first
interface is configured (create_interface). This can lead to situations
where the net_stack_interface module is loaded and calls to socket_open
happens although the net_socket module is not loaded. I have the following
boot traces after adding some dprintf:
...
stack_interface init
net_socket init
register_domain(1, internet)
unregister_domain(0x8101c550, 1, internet)
net_socket uninit
net_socket init
net_socket uninit
net_socket init
register_domain(9, unix)
unregister_domain(0x8101c410, 9, unix)
net_socket uninit
stack_interface_open
socket_open => net_socket B_MODULE_INIT not called yet!
net_socket init => Seems to be triggered by get_domain_protocol call from
create_socket from socket_open call!
register_domain(1, internet)
...
I suppose that it is not normal that calls to a module are done before it
is loaded/initialized. However I am not sure whether this should be done
while loading the net_stack, or at another location.
Romain.
Other related posts: