netgraph panics

Hiten Pandya hmp at
Mon Aug 22 05:34:50 PDT 2005


I have encountered this issue with netgraph when I was doing an update of 
the code.

The problem is that in 4.x, the netgraph code used to be called from 
either the syscall process context (if compiled in) or the kldload(2) 
process context.  When our network socket code changed, it started calling 
the ng_mkpeer() function from the socket dispatch thread (netisr_cpuX), 
which doesn't have a process associated with it, unlike the system call 
context paths.

One of these days I basically need to fix the linker API to work without 
the process context or use a different one.

A workaround to this problem is to load the 'ng_ksocket.ko' module before 
loading other netgraph modules and executing any of the netgraph commands.

kldload netgraph
kldload ng_ksocket
kldload ng_netflow
kldload ng_ether
kldload ng_tee
kldload ng_one2many
Please try this and let us know how it works out.


Yury Tarasievich wrote:
When trying netgraph,  I've got the panic. I have core saved but can't make 
much of it, the system is current of July 1, however, these files weren't 
changed after that date. And wasn't attempting anything funny, just these two 
scripts in succession (they produce some supposedly non-fatal errors):

kldload ng_netflow
kldload ng_ether
kldload ng_tee
kldload ng_one2many
ngctl -f- <<-SEQ
mkpeer ${if_here}: tee lower left
connect ${if_here}: ${if_here}:lower upper right
mkpeer ${if_here}:lower one2many left2right many0
connect ${if_here}:lower.left2right ${if_here}:lower many1 right2left
name ${if_here}:lower.right2left o2m
mkpeer o2m: netflow one iface0
name o2m:one netflow
#mkpeer netflow: ksocket export inet/stream/tcp
#msg netflow:export connect inet/

kldload ng_ether
kldload ng_tee
kldload ng_one2many
ngctl mkpeer ${if_here}: tee lower left
ngctl connect ${if_here}: ${if_here}:lower upper right
ngctl mkpeer ${if_here}:lower one2many left2right many0
ngctl connect ${if_here}:lower.left2right ${if_here}:lower many1 right2left
ngctl name ${if_here}:lower.right2left o2m
ngctl mkpeer o2m: ksocket one inet/stream/tcp
ngctl msg o2m:one bind inet/
The backtrace is (fragment):

#23 0xc043f552 in Debugger (msg=0x0) at cpufunc.h:68
#24 0xc0285887 in panic (fmt=0xc04a4076 "assertion: p != NULL in %s") 
at ../../kern/kern_shutdown.c:618
#25 0xc026d4ab in link_aout_load_file (filename=0xc2366260 
"/modules/ng_ksocket.ko.ko", result=0x0)
    at ../../kern/link_aout.c:208
#26 0xc026d323 in link_aout_load_module (filename=0xc2366260 
"/modules/ng_ksocket.ko.ko", result=0xd2c52bf4)
    at ../../kern/link_aout.c:151
#27 0xc026bef1 in linker_load_file (filename=0xc23f7ce8 
"/modules/ng_ksocket.ko", result=0xd2c52c20)
    at ../../kern/kern_linker.c:271

../../kern/link_aout.c:151 is:

static int
link_aout_load_module(const char* filename, linker_file_t* result)
    caddr_t             modptr, baseptr;
    char                *type;
    struct exec         *ehdr;
    aout_file_t         af;
    linker_file_t       lf;
    int                 error;
    /* Look to see if we have the module preloaded. */
    if ((modptr = preload_search_by_name(filename)) == NULL)
        return(link_aout_load_file(filename, result));
and so ../../kern/link_aout.c:208 is:

static int
link_aout_load_file(const char* filename, linker_file_t* result)
    struct nlookupdata nd;
    struct thread *td = curthread;
    struct proc *p = td->td_proc;
    struct vnode *vp;
    int error = 0;
    int resid;
    struct exec header;
    aout_file_t af;
    linker_file_t lf;
    char *pathname;
    KKASSERT(p != NULL);

More information about the Bugs mailing list