sysctl_set panic

From: Herbert Acker (hacker2004_at_damon.com)
Date: 08/28/04

  • Next message: Sam Paior: "sysctl"
    Date: Sat, 28 Aug 2004 13:48:30 +1000
    To: freebsd-hackers@freebsd.org
    
    

    Hi. I have been occasionally plagued by panics in KLD:

         at /usr/src/sys/i386/i386/trap.c:466
    #6 0xc016c2dc in sysctl_register_oid (oidp=0x0)
         at /usr/src/sys/kern/kern_sysctl.c:92
    #7 0xc016c841 in sysctl_register_set (lsp=0xcd5000a0)
         at /usr/src/sys/kern/kern_sysctl.c:391
    #8 0xc0157847 in linker_file_register_sysctls (lf=0xcd4ea180)
         at /usr/src/sys/kern/kern_linker.c:224
    #9 0xc01578fc in linker_load_file (

    It bit me once several years ago, and then again today.
    It croaks because it finds the sysctl_set symbol in the KLD but
    the OIDs are zero.

    I finally got pissed off enough and figured out what the problem is,
    instead of using the dynamic-sysctls approach I adopted the other time.

    Essentially, I have two KLDs. One imports symbols from the other.
    I have them in separate dirs, and have a -I ../dir0/ in the
    Makefile of the KLD which imports the interface of the other KLD.

    IE:

            dir0/has_interfaces_and_sysctls.c
            dir1/uses_interfaces_no_sysctls.c

            dir1/Makefile: CFLAGS += -I../dir0/

    gensetdefs creates files to manage the .set sections.

    The setdefs0.c includes setdefs.h, and the ../dir0/setdefs.h has some
    sysctls, so it has the set definitions for those sysctls.

    The second KLD has no sysctls. The second KLD is being linked with
    a setdefs0.o which is made using the ../dir0/setdefs.h.

    Simple fix: put "-I." in the CFLAGS prior to -I../dir0/.

    Hopefully, this will be helpful to some others.

    Damon

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Sam Paior: "sysctl"