Bug 221487 - [bsnmpd] crashes on startup with the enabled module begemotSnmpdModulePath."pf"
Summary: [bsnmpd] crashes on startup with the enabled module begemotSnmpdModulePath."pf"
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-13 21:04 UTC by Vladislav V. Prodan
Modified: 2019-06-21 07:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladislav V. Prodan 2017-08-13 21:04:48 UTC
Bsnmpd crashes on startup with the enabled module begemotSnmpdModulePath."pf"

FreeBSD tank1.storage.com 11.1-STABLE FreeBSD 11.1-STABLE #0 r322164: Mon Aug  7 15:33:19 UTC 2017     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

I uncomment string
#begemotSnmpdModulePath."pf"    = "/usr/lib/snmp_pf.so"
in the file /etc/snmpd.config

And after running command service bsnmpd onestart received errors:
...
Aug 12 14:02:19 tank1 snmpd[819]: disk_OS_get_disks: adding device 'ada0' to device list
Aug 12 14:02:19 tank1 snmp_lm75[819]: pf_init(): open(): No such file or directory
Aug 12 14:02:19 tank1 kernel: Aug 12 14:02:19 tank1 snmp_lm75[819]: pf_init(): open(): No such file or directory
Aug 12 14:02:19 tank1 snmp_lm75[819]: lm_load: init failed: -1
Aug 12 14:02:19 tank1 kernel: Aug 12 14:02:19 tank1 snmp_lm75[819]: lm_load: init failed: -1
Aug 12 14:02:19 tank1 snmp_lm75[819]: init dep failed: 13 1.3.6.1.4.1.12325.1.1.1.6 2.112.102
Aug 12 14:02:19 tank1 kernel: Aug 12 14:02:19 tank1 snmp_lm75[819]: init dep failed: 13 1.3.6.1.4.1.12325.1.1.1.6 2.112.102
Aug 12 14:02:19 tank1 kernel: pid 819 (bsnmpd), uid 0: exited on signal 11 (core dumped)

I understand that you need to load the kernel module PF (/boot/kernel/pf.ko)
And then bsnmpd with this module will not crash.
Comment 1 Vladislav V. Prodan 2019-03-19 11:19:45 UTC
Similar behavior with 12-STABLE

snmp_lm75[1906]: lm_load: open /usr/lib/snmp_pf.so: Undefined symbol "pf_altq"
snmp_lm75[1906]: init dep failed: 13 1.3.6.1.4.1.12325.1.1.1.6 2.112.102
kernel: pid 1906 (bsnmpd), jid 0, uid 0: exited on signal 11 (core dumped)

# uname -a
FreeBSD template-12-0.domain.com 12.0-STABLE FreeBSD 12.0-STABLE r345274 SUPPORT-12-0-1  amd64
Comment 2 Vladislav V. Prodan 2019-03-19 12:08:32 UTC
(In reply to Vladislav V. Prodan from comment #1)

Core was generated by `/usr/sbin/bsnmpd -p /var/run/snmpd.pid'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libbegemot.so.4...Reading symbols from /usr/lib/debug//lib/libbegemot.so.4.debug...done.
done.
Loaded symbols for /lib/libbegemot.so.4
Reading symbols from /usr/lib/libbsnmp.so.6...Reading symbols from /usr/lib/debug//usr/lib/libbsnmp.so.6.debug...done.
done.
Loaded symbols for /usr/lib/libbsnmp.so.6
Reading symbols from /usr/lib/libwrap.so.6...Reading symbols from /usr/lib/debug//usr/lib/libwrap.so.6.debug...done.
done.
Loaded symbols for /usr/lib/libwrap.so.6
Reading symbols from /lib/libc.so.7...BFD: /lib/libc.so.7: invalid relocation type 37
BFD: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-x86-64.c:276
Reading symbols from /usr/lib/debug//lib/libc.so.7.debug...done.
done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /lib/libcrypto.so.111...Reading symbols from /usr/lib/debug//lib/libcrypto.so.111.debug...done.
done.
Loaded symbols for /lib/libcrypto.so.111
Reading symbols from /lib/libthr.so.3...Reading symbols from /usr/lib/debug//lib/libthr.so.3.debug...done.
done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /libexec/ld-elf.so.1...Reading symbols from /usr/lib/debug//libexec/ld-elf.so.1.debug...done.
done.
Loaded symbols for /libexec/ld-elf.so.1
#0  strlen (str=0x8047babd3 <Address 0x8047babd3 out of bounds>) at /usr/src/lib/libc/string/strlen.c:101
101             va = (*lp - mask01);
[New Thread 8009f9000 (LWP 100405/<unknown>)]
Comment 3 Vladislav V. Prodan 2019-03-19 12:09:47 UTC
(In reply to Vladislav V. Prodan from comment #2)

(gdb) bt
#0  strlen (str=0x8047babd3 <Address 0x8047babd3 out of bounds>) at /usr/src/lib/libc/string/strlen.c:101
#1  0x00000008003e4a40 in __vfprintf (fp=0x800686ec0, locale=0x8004554e8, fmt0=<value optimized out>, ap=0x7fffffffb5b0)
    at /usr/src/lib/libc/stdio/vfprintf.c:854
#2  0x00000008003e2ba4 in vfprintf_l (fp=0x800686ec0, locale=0x8004554e8, fmt0=0x8002d057d "%s %d - - ", ap=0x7fffffffb5b0)
    at /usr/src/lib/libc/stdio/vfprintf.c:285
#3  0x00000008003ea62b in fprintf (fp=0x800686ec0, fmt=0x8002d057d "%s %d - - ") at /usr/src/lib/libc/stdio/fprintf.c:57
#4  0x0000000800429487 in vsyslog (pri=<value optimized out>, fmt=0x20516b "error in config file", ap=0x7fffffffc510)
    at /usr/src/lib/libc/gen/syslog.c:210
#5  0x00000008004291bd in syslog (pri=<value optimized out>, fmt=<value optimized out>) at /usr/src/lib/libc/gen/syslog.c:129
#6  0x0000000000214b61 in main (argc=0, argv=<value optimized out>)
Current language:  auto; currently minimal
Comment 4 Vladislav V. Prodan 2019-03-19 12:21:04 UTC
(In reply to Vladislav V. Prodan from comment #3)

(gdb) bt full
#0  strlen (str=0x8047babd3 <Address 0x8047babd3 out of bounds>) at /usr/src/lib/libc/string/strlen.c:101
        p = 0x8047babd3 <Address 0x8047babd3 out of bounds>
        lp = (const long unsigned int *) 0x8047babd0
        va = <value optimized out>
        vb = <value optimized out>
#1  0x00000008003e4a40 in __vfprintf (fp=0x800686ec0, locale=0x8004554e8, fmt0=<value optimized out>, ap=0x7fffffffb5b0)
    at /usr/src/lib/libc/stdio/vfprintf.c:854
        mbs = {__mbstate8 = 0x7fffffffb3c0 "\230����\177", _mbstateL = 140737488335768}
        mbseqlen = <value optimized out>
        xdigs_lower = 0x8002dd6f0 "0123456789abcdef0123456789ABCDEF", ' ' <repeats 16 times>, '0' <repeats 16 times>, ",\224\020"
        xdigs_upper = 0x8002dd700 "0123456789ABCDEF", ' ' <repeats 16 times>, '0' <repeats 16 times>, ",\224\020"
        expstr = 0x7fffffffb3b8 "x $"
        buf = 0x7fffffffb300 ""
        ox = 0x7fffffffb258 "\200"
        statargtable = 0x7fffffffb280
        orgap = 0x7fffffffb260
        nextarg = 2
        saved_errno = 2
        ret = 0
        decimal_point = <value optimized out>
        decpt_len = 1
        cp = <value optimized out>
        dtoaresult = 0x0
        convbuf = 0x0
        expchar = 1 '\001'
        expsize = 1
        ndig = 1
        ulval = 141733920769
        ujval = 140737488336256
        xdigs = 0xe <Address 0xe out of bounds>
        ch = <value optimized out>
        dprec = -1
        width = 0
        prec = -1
        flags = 0
        fmt = 0x8002d057f " %d - - "
        size = <value optimized out>
        n = <value optimized out>
        sign = Cannot access memory at address 0x0
Comment 5 commit-hook freebsd_committer 2019-06-21 07:46:03 UTC
A commit references this bug:

Author: syrinx
Date: Fri Jun 21 07:45:59 UTC 2019
New revision: 349265
URL: https://svnweb.freebsd.org/changeset/base/349265

Log:
  No need for each bsnmpd(1) module to open connection to syslog

  bsnmpd(1) main does that early on init and the connection is available
  to all loaded modules

  Event:		Vienna Hackathon 2019
  PR:		233431 , 221487
  MFC after:	2 weeks

Changes:
  head/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c