Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 2004 11:14:55 +0200
From:      Wim Rijnders <wim@mediamessage.nl>
To:        freebsd-net@freebsd.org
Subject:   netgraph: kernel panic due to M_DONTWAIT when connecting ksocket
Message-ID:  <1085390095.633.26.camel@crazyharry>

next in thread | raw e-mail | index | archive | help
Hello,

When trying to use a netgraph ksocket for a tcp connection, we get a
kernel panic on opening the connection. The panic is a result of a
KASSERT() on the value of a flag which we don't set ourselves and which
we don't appear to have control over.

Details of our investigation follow. What can we do to fix this?

---
We're using the 5.2-CURRENT release.

* We use ksockets in netgraph to create a tcp connection. The kernel
panics when creating a connection with code similar to:

    result= NgSendMsg(ctrlSoc, path, NGM_KSOCKET_COOKIE,
                 NGM_KSOCKET_CONNECT, &addr, sizeof(addr) )
 
* The kernel panic occurs in ng_ksocket.c , function
ng_ksocket_incoming2() on a call to macro NG_MKMESSAGE().

This macro is defined in ng_message.h. One of the first things it does
is perform this KASSERT():

KASSERT(!(how & M_DONTWAIT),                                  \
     ("NG_MKMESSAGE() with how=M_DONTWAIT (%d)\n", how));      \   


* We do not set the  M_DONTWAIT flag anywhere our code. The setting can
be traced to call in sowakeup(), line 320 in
/usr/src/sys/kern/uipc_socket2.c:

    if (sb->sb_flags & SB_UPCALL)
        sh freebeer*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
---

Kind regards,

Wim Rijnders
Buyways BV.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1085390095.633.26.camel>