From owner-freebsd-net@FreeBSD.ORG Fri Jan 27 14:18:23 2012 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B32261065670; Fri, 27 Jan 2012 14:18:23 +0000 (UTC) (envelope-from alexey@kouznetsov.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 590D88FC14; Fri, 27 Jan 2012 14:18:23 +0000 (UTC) Received: by qcse14 with SMTP id e14so1302596qcs.13 for ; Fri, 27 Jan 2012 06:18:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.111.89 with SMTP id r25mr2476219qcp.106.1327672234311; Fri, 27 Jan 2012 05:50:34 -0800 (PST) Received: by 10.229.39.13 with HTTP; Fri, 27 Jan 2012 05:50:34 -0800 (PST) In-Reply-To: References: <4ebc3732.86962a0a.7ab9.ffffa29dSMTPIN_ADDED@mx.google.com> Date: Fri, 27 Jan 2012 17:50:34 +0400 Message-ID: From: Alexey Kouznetsov To: zi@FreeBSD.org, net@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Fwd: [ net-snmp-Bugs-3434824 ] coredump on HUP while disks read X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2012 14:18:23 -0000 Hello! There are bug in net-snmp. net-snmp die (coredump) on SIGHUP while we have disk command defined in snmpd.*conf. Bellow fix in main net-snmp tree. I think it is good idea to add such small patch to the FreeBSD port unlil they release new version an new version will be included to the ports. You can see path an butom of mail conversation bellow Thank you! With best regards /Alexey ---------- Forwarded message ---------- From: SourceForge.net Date: 2011/11/11 Subject: [ net-snmp-Bugs-3434824 ] coredump on HUP while disks read To: "SourceForge.net" Bugs item #3434824, was opened at 2011-11-07 23:45 Message generated for change (Comment added) made by nba You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112694&aid=3434824&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: agent Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Alexey (st-da) Assigned to: Niels Baggesen (nba) Summary: coredump on HUP while disks read Initial Comment: FreeBSD xxx 8.2-STABLE FreeBSD 8.2-STABLE #9: Tue Oct 11 07:07:46 UTC 2011 root@xxx:/usr/obj/usr/src/sys/AAASMP i386 but some error reproduced at amd64 system net-snmp from ports net-snmp-5.7_4 net snmp started as: --- /usr/local/sbin/snmpd -p /var/run/snmpd.pid -Lf /var/log/snmpd.log --- We have commands like: disk / disk /usr disk /var in config. when we kill -HUP ` cat /var/run/snmpd.pid ` we got "kernel: pid 61129 (snmpd), uid 0: exited on signal 11 (core dumped)" If we remove disk commands error disapear. if we add includeAllDisks or any single disk we got an error. snmpd.cons is simple some access lines and this disk lines. snmpd works untill we send sighup. (unlill we logrotate, and logrotate send sighup for reopen log file). If we disable logging problem hides (we do not need sent sighup, so it will work) gdb output bellow: Core was generated by `snmpd'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/local/lib/libnetsnmpagent.so.30...done. Loaded symbols for /usr/local/lib/libnetsnmpagent.so.30 Reading symbols from /usr/local/lib/libnetsnmpmibs.so.30...done. Loaded symbols for /usr/local/lib/libnetsnmpmibs.so.30 Reading symbols from /usr/lib/libwrap.so.6...done. Loaded symbols for /usr/lib/libwrap.so.6 Reading symbols from /usr/local/lib/libnetsnmp.so.30...done. Loaded symbols for /usr/local/lib/libnetsnmp.so.30 Reading symbols from /lib/libm.so.5...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /lib/libkvm.so.5...done. Loaded symbols for /lib/libkvm.so.5 Reading symbols from /lib/libdevstat.so.7...done. Loaded symbols for /lib/libdevstat.so.7 Reading symbols from /lib/libcrypto.so.6...done. Loaded symbols for /lib/libcrypto.so.6 Reading symbols from /usr/lib/libelf.so.1...done. Loaded symbols for /usr/lib/libelf.so.1 Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x2814a8a5 in disk_parse_config (token=0xbfbfdb8c "disk", cptr=0xbfbfdf9c "10240") at ucd-snmp/disk_hw.c:193 193 disks[numdisks++] = entry; (gdb) where #0 0x2814a8a5 in disk_parse_config (token=0xbfbfdb8c "disk", cptr=0xbfbfdf9c "10240") at ucd-snmp/disk_hw.c:193 #1 0x28269830 in run_config_handler (lptr=0x286878a0, token=0xbfbfdb8c "disk", cptr=0xbfbfdf91 "/ 10240", when=0) at read_config.c:546 #2 0x2826a70a in read_config (filename=0xbfbfe440 "/usr/local/etc/snmp/snmpd.conf", line_handler=0x2860f080, when=0) at read_config.c:939 #3 0x2826b7ae in read_config_files_in_path (path=Variable "path" is not available. ) at read_config.c:1282 #4 0x2826bb86 in read_config_files_of_type (when=0, ctmp=0x28620040) at read_config.c:1365 #5 0x2826bc14 in read_config_files (when=0) at read_config.c:1406 #6 0x2826c39f in read_configs () at read_config.c:1018 #7 0x280bc928 in update_config () at agent_read_config.c:292 #8 0x0804b91b in SnmpdReconfig () #9 0x0804a127 in ?? () #10 0x00000000 in ?? () #11 0x00000000 in ?? () #12 0xbfbfea08 in ?? () #13 0x0804a127 in ?? () #14 0x00000005 in ?? () #15 0xbfbfea30 in ?? () #16 0xbfbfea48 in ?? () #17 0xbfbfea10 in ?? () #18 0xbfbfea2c in ?? () #19 0x00000000 in ?? () #20 0xbfbfea28 in ?? () #21 0x0804a098 in ?? () Previous frame inner to this frame (corrupt stack?) (gdb) list 292 read_configs(); 293 } 294 295 296 void 297 snmpd_register_config_handler(const char *token, 298 void (*parser) (const char *, char *), 299 void (*releaser) (void), const char *help) 300 { 301 DEBUGMSGTL(("snmpd_register_app_config_handler", ---------------------------------------------------------------------- >Comment By: Niels Baggesen (nba) Date: 2011-11-10 12:42 Message: Best I can tell this fiexed the problem, and I have applied this fix to Net-SNMP Thanks for the bug report. ---------------------------------------------------------------------- Comment By: Niels Baggesen (nba) Date: 2011-11-08 12:55 Message: I think a single missing line is causing the trouble. Please try this: --- a/agent/mibgroup/ucd-snmp/disk_hw.c +++ b/agent/mibgroup/ucd-snmp/disk_hw.c @@ -137,6 +137,7 @@ disk_free_config(void) if (disks) { free( disks ); disks = NULL; + maxdisks = numdisks = 0; } allDisksIncluded = 0; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112694&aid=3434824&group_id=12694