NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/56515: dhcpd dumps core after running a while (SIGSEGV)



The following reply was made to PR bin/56515; it has been noted by GNATS.

From: Christos Zoulas <christos%zoulas.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/56515: dhcpd dumps core after running a while (SIGSEGV)
Date: Sat, 20 Nov 2021 16:52:03 -0500

 --Apple-Mail=_533F5655-CE23-4249-A7C7-069855782BB4
 Content-Type: multipart/mixed;
 	boundary="Apple-Mail=_523264A0-E9A9-4A81-B969-023A2EC1CE7B"
 
 
 --Apple-Mail=_523264A0-E9A9-4A81-B969-023A2EC1CE7B
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 It seems that it gets bad thread id 4 >= 4 for me. Perhaps it has an
 active thing in the queue before the code tries to reduce its size.
 I have not figured it out yet.
 
 christos
 
 
 --Apple-Mail=_523264A0-E9A9-4A81-B969-023A2EC1CE7B
 Content-Disposition: attachment;
 	filename=dhcpd.diff
 Content-Type: application/octet-stream;
 	name=dhcpd.diff;
 	x-unix-mode=0664
 Content-Transfer-Encoding: 7bit
 
 ? o
 Index: hp.c
 ===================================================================
 RCS file: /cvsroot/src/external/mpl/bind/dist/lib/isc/hp.c,v
 retrieving revision 1.4
 diff -u -p -u -r1.4 hp.c
 --- hp.c	29 Apr 2021 17:26:12 -0000	1.4
 +++ hp.c	20 Nov 2021 19:27:15 -0000
 @@ -1,4 +1,4 @@
 -/*	$NetBSD: hp.c,v 1.4 2021/04/29 17:26:12 christos Exp $	*/
 +/*	$NetBSD: hp.c,v 1.1.1.3 2021/04/29 16:46:31 christos Exp $	*/
  
  /*
   * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
 @@ -55,6 +55,9 @@
  #include <isc/thread.h>
  #include <isc/util.h>
  
 +#include <syslog.h>
 +#include <stdlib.h>
 +
  #define HP_MAX_THREADS 128
  static int isc__hp_max_threads = HP_MAX_THREADS;
  #define HP_MAX_HPS     4 /* This is named 'K' in the HP paper */
 @@ -84,6 +87,8 @@ tid(void) {
  
  void
  isc_hp_init(int max_threads) {
 +	syslog(LOG_ERR|LOG_CONS, "setting maxthreads to %d from %d", max_threads,
 +	    isc__hp_max_threads);
  	isc__hp_max_threads = max_threads;
  	isc__hp_max_retired = max_threads * HP_MAX_HPS;
  }
 @@ -175,15 +180,25 @@ isc_hp_protect_release(isc_hp_t *hp, int
  
  void
  isc_hp_retire(isc_hp_t *hp, uintptr_t ptr) {
 -	hp->rl[tid()]->list[hp->rl[tid()]->size++] = ptr;
 -	INSIST(hp->rl[tid()]->size < isc__hp_max_retired);
 +	int xtid = tid();
 +	if (xtid < 0 || xtid >= isc__hp_max_threads) {
 +		syslog(LOG_ERR|LOG_CONS, "bad thread id %d >= %d", xtid,
 +		    isc__hp_max_threads);
 +		return;
 +	}
 +	if (hp->rl[xtid] == NULL) {
 +		syslog(LOG_ERR|LOG_CONS, "null rl for thread id %d", xtid);
 +		abort();
 +	}
 +	hp->rl[xtid]->list[hp->rl[xtid]->size++] = ptr;
 +	INSIST(hp->rl[xtid]->size < isc__hp_max_retired);
  
 -	if (hp->rl[tid()]->size < HP_THRESHOLD_R) {
 +	if (hp->rl[xtid]->size < HP_THRESHOLD_R) {
  		return;
  	}
  
 -	for (int iret = 0; iret < hp->rl[tid()]->size; iret++) {
 -		uintptr_t obj = hp->rl[tid()]->list[iret];
 +	for (int iret = 0; iret < hp->rl[xtid]->size; iret++) {
 +		uintptr_t obj = hp->rl[xtid]->list[iret];
  		bool can_delete = true;
  		for (int itid = 0; itid < isc__hp_max_threads && can_delete;
  		     itid++) {
 @@ -196,11 +211,11 @@ isc_hp_retire(isc_hp_t *hp, uintptr_t pt
  		}
  
  		if (can_delete) {
 -			size_t bytes = (hp->rl[tid()]->size - iret) *
 -				       sizeof(hp->rl[tid()]->list[0]);
 -			memmove(&hp->rl[tid()]->list[iret],
 -				&hp->rl[tid()]->list[iret + 1], bytes);
 -			hp->rl[tid()]->size--;
 +			size_t bytes = (hp->rl[xtid]->size - iret) *
 +				       sizeof(hp->rl[xtid]->list[0]);
 +			memmove(&hp->rl[xtid]->list[iret],
 +				&hp->rl[xtid]->list[iret + 1], bytes);
 +			hp->rl[xtid]->size--;
  			hp->deletefunc((void *)obj);
  		}
  	}
 
 --Apple-Mail=_523264A0-E9A9-4A81-B969-023A2EC1CE7B
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=us-ascii
 
 
 
 > On Nov 20, 2021, at 3:10 PM, greywolf%starwolf.com@localhost wrote:
 >=20
 >> Number:         56515
 >> Category:       bin
 >> Synopsis:       dhcpd dumps core after running a while (SIGSEGV)
 >> Confidential:   no
 >> Severity:       critical
 >> Priority:       medium
 >> Responsible:    bin-bug-people
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Sat Nov 20 20:10:00 +0000 2021
 >> Originator:     Greywolf
 >> Release:        NetBSD 9.99.92
 >> Organization:
 >> Environment:
 > System: NetBSD deep-thought.sub-etha.starwolf.com 9.99.92 NetBSD =
 9.99.92 (DEEP-THOUGHT) #0: Wed Nov 17 17:39:14 PST 2021 =
 greywolf%eddie.starwolf.com@localhost:/sys/arch/amd64/compile/DEEP-THOUGHT amd64
 > Architecture: x86_64
 > Machine: amd64
 > /usr/sbin/dhcpd:
 > 	-lirs.18 =3D> /usr/lib/libirs.so.18
 > 	-lblocklist.0 =3D> /usr/lib/libblocklist.so.0
 > 	-lc.12 =3D> /usr/lib/libc.so.12
 > 	-lpthread.1 =3D> /usr/lib/libpthread.so.1
 > 	-lgssapi.11 =3D> /usr/lib/libgssapi.so.11
 > 	-lkrb5.27 =3D> /usr/lib/libkrb5.so.27
 > 	-lhx509.6 =3D> /usr/lib/libhx509.so.6
 > 	-lasn1.10 =3D> /usr/lib/libasn1.so.10
 > 	-lcom_err.8 =3D> /usr/lib/libcom_err.so.8
 > 	-lroken.20 =3D> /usr/lib/libroken.so.20
 > 	-lutil.7 =3D> /usr/lib/libutil.so.7
 > 	-lcrypt.1 =3D> /usr/lib/libcrypt.so.1
 > 	-lcrypto.14 =3D> /usr/lib/libcrypto.so.14
 > 	-lwind.1 =3D> /usr/lib/libwind.so.1
 > 	-lheimbase.2 =3D> /usr/lib/libheimbase.so.2
 > 	-lsqlite3.1 =3D> /usr/lib/libsqlite3.so.1
 > 	-lm.0 =3D> /usr/lib/libm.so.0
 > 	-lheimntlm.5 =3D> /usr/lib/libheimntlm.so.5
 > 	-lisccfg.18 =3D> /usr/lib/libisccfg.so.18
 > 	-lisc.18 =3D> /usr/lib/libisc.so.18
 > 	-lz.1 =3D> /usr/lib/libz.so.1
 > 	-ldns.18 =3D> /usr/lib/libdns.so.18
 > 	-lexecinfo.0 =3D> /usr/lib/libexecinfo.so.0
 > 	-lelf.2 =3D> /usr/lib/libelf.so.2
 > 	-lkvm.6 =3D> /usr/lib/libkvm.so.6
 > 	-lssl.14 =3D> /usr/lib/libssl.so.14
 > 	-lipsec.3 =3D> /usr/lib/libipsec.so.3
 > /usr/sbin/dhcpd:
 >     $NetBSD: crt0.S,v 1.4 2018/11/26 17:37:46 joerg Exp $
 >     $NetBSD: crt0-common.c,v 1.24 2021/04/20 21:42:31 christos Exp $
 >     $NetBSD: crti.S,v 1.1 2010/08/07 18:01:35 joerg Exp $
 >     $NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $
 >     $NetBSD: dhcpd.c,v 1.4 2021/05/26 22:52:32 christos Exp $
 >     $NetBSD: dhcp.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: dhcpv6.c,v 1.4 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: bootp.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: confpars.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: db.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: class.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: failover.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: omapi.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: mdb.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: mdb6.c,v 1.5 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: stables.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: salloc.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: ddns.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: dhcpleasequery.c,v 1.3 2020/08/03 21:10:57 christos Exp $
 >     $NetBSD: dispatch.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: icmp.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: comapi.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: memory.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: discover.c,v 1.4 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: execute.c,v 1.3 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: dns.c,v 1.4 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: alloc.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: tables.c,v 1.3 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: tree.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: options.c,v 1.5 2021/01/13 17:01:31 christos Exp $
 >     $NetBSD: ctrace.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: socket.c,v 1.4 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $
 >     $NetBSD: print.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $
 >     $NetBSD: ethernet.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: conflex.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: parse.c,v 1.4 2021/05/26 22:52:31 christos Exp $
 >     $NetBSD: ns_name.c,v 1.3 2020/08/03 21:10:56 christos Exp $
 >     $NetBSD: inet.c,v 1.2 2018/04/07 22:37:29 christos Exp $
 >     $NetBSD: convert.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: auth.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: handle.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: support.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: hash.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: protocol.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: generic.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: listener.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: connection.c,v 1.3 2019/01/10 17:41:47 christos Exp $
 >     $NetBSD: isclib.c,v 1.6 2021/08/19 11:50:56 christos Exp $
 >     $NetBSD: toisc.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: array.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: dispatch.c,v 1.4 2019/01/27 01:51:50 christos Exp $
 >     $NetBSD: result.c,v 1.3 2019/02/25 02:31:57 christos Exp $
 >     $NetBSD: buffer.c,v 1.4 2019/01/27 01:51:50 christos Exp $
 >     $NetBSD: trace.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: alloc.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: errwarn.c,v 1.4 2020/11/12 22:11:03 christos Exp $
 >     $NetBSD: message.c,v 1.2 2018/04/07 22:37:30 christos Exp $
 >     $NetBSD: crtend.S,v 1.1 2010/08/07 18:01:34 joerg Exp $
 >     $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:35 joerg Exp $
 >=20
 > dhcpd.conf: (sanitized)
 > # *** GLOBAL PARAMETERS ***
 >=20
 > default-lease-time 600;
 > max-lease-time 7200;
 >=20
 > # If this DHCP server is the official DHCP server for the local
 > # network, the authoritative directive should be uncommented.
 > authoritative;
 >=20
 > # Dynamic DNS update scheme - must be set to "none", "interim" or =
 "ad-hoc".
 > ddns-update-style interim;
 > #ddns-update-style none;
 >=20
 > # Use this to send dhcp log messages to a different log file (you also
 > # have to hack syslog.conf to complete the redirection).
 > log-facility daemon;
 >=20
 > zone internal.starwolf.com. {
 >    primary 172.31.250.11;
 > }
 >=20
 > zone 250.31.172.in-addr.arpa. {
 >    primary 172.31.250.11;
 > }
 >=20
 > subnet 172.31.250.0 netmask 255.255.254.0 {
 >    interface wm1;
 > 	range 172.31.251.0 172.31.251.240;
 > 	option domain-name-servers 172.31.250.11, 172.31.250.2, 8.8.8.8;
 > 	option domain-name "internal.starwolf.com.";
 > 	option routers 172.31.250.1;
 >=20
 > 	option broadcast-address 172.31.251.255;
 > 	default-lease-time 600;
 > 	max-lease-time    7200;
 > 	allow client-updates;
 >=20
 > }
 >=20
 > host milliways {
 > 	hardware ethernet C0:FF:EE:0D:EC:AF
 > 	fixed-address	172.31.251.242;
 > 	option domain-name-servers 192.168.60.2, 172.31.250.11, =
 172.31.250.2;
 > 	prepend domain-name "mywork.com ";
 > 	option routers 172.31.250.1;
 > }
 >=20
 > Termination backtrace:
 > Program terminated with signal SIGSEGV, Segmentation fault.
 > #0  0x0000764028c46076 in isc_hp_retire () from /usr/lib/libisc.so.18
 > [Current thread is 1 (process 9295)]
 >=20
 >> Description:
 > 	dhcpd runs for a couple hours and then gives up the ghost with
 > 	a SIGSEGV
 >> How-To-Repeat:
 > 	/usr/bin/dhcpd -q; connect several devices.
 >> Fix:
 > 	Currently, once a minute, I am running a =
 check-and-restart-if-needed
 > 	script via cron to keep the dhcpd up and going.
 
 
 --Apple-Mail=_523264A0-E9A9-4A81-B969-023A2EC1CE7B--
 
 --Apple-Mail=_533F5655-CE23-4249-A7C7-069855782BB4
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP
 
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org
 
 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCYZluAwAKCRBxESqxbLM7
 Or8nAJ9SWDY3Th0wdNRglX2uvZkbXNnNIwCg3y6IZwGzrDbi1BARc/5CjEzKp8I=
 =HS21
 -----END PGP SIGNATURE-----
 
 --Apple-Mail=_533F5655-CE23-4249-A7C7-069855782BB4--
 


Home | Main Index | Thread Index | Old Index