From owner-freebsd-current@FreeBSD.ORG Thu Feb 12 08:22:12 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A91F13B; Thu, 12 Feb 2015 08:22:12 +0000 (UTC) Received: from odin.blazingdot.com (odin.blazingdot.com [204.109.60.170]) by mx1.freebsd.org (Postfix) with ESMTP id 5E339C7E; Thu, 12 Feb 2015 08:22:12 +0000 (UTC) Received: by odin.blazingdot.com (Postfix, from userid 1001) id 1C7C8131E86; Thu, 12 Feb 2015 03:17:00 -0500 (EST) Date: Thu, 12 Feb 2015 03:16:59 -0500 From: Marcus Reid To: =?iso-8859-1?Q?Jean-S=E9bastien_P=E9dron?= Subject: Re: unbound crashes on bootup Message-ID: <20150212081659.GA12716@blazingdot.com> References: <1264.1423227963@critter.freebsd.dk> <54DB9A0C.1010806@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54DB9A0C.1010806@FreeBSD.org> X-Coffee-Level: nearly-fatal User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 08:22:12 -0000 On Wed, Feb 11, 2015 at 07:06:04PM +0100, Jean-Sébastien Pédron wrote: > On 06.02.2015 14:06, Poul-Henning Kamp wrote: > > I just updated my -current to r278283, and unbound (still) croaks > > during bootup: > > Hi! > > I have a similar problem. Also, unbound crashes each time I start/stop > OpenVPN. I suppose the problem is the same in both cases. > > The crash happens in the config_lookup_uid() in > contrib/unbound/util/config_file.c. Here's the code: > > struct passwd *pwd; > if((pwd = getpwnam(cfg->username)) == NULL) > log_err("user '%s' does not exist.", cfg->username); > cfg->uid = pwd->pw_uid; > > getpwnam(3) returns NULL: an error message is logged but the function > doesn't return. Therefore, the program segfaults on "pwd->pw_uid" on the > next line. The reason this crash happens is that unbound is chrooted and there is no /etc/pwd.db for getpwnam() to look at. A workaround is to mkdir /var/unbound/etc and put a copy of /etc/pwd.db into it (or even a reduced version that only contains the unbound user). I submitted a bug report for this yesterday. Marcus > > But why did getpwnam(3) return NULL in the first place? It looks for the > "unbound" user which exists. getpwnam() calls _nsdispatch() which fails. > > I have the default nsswitch.conf. I didn't look at the problem more > deeply yet, but could getpwnam()/_nsdispatch() be unhappy with the > absence of a working DNS resolver (unbound is being (re)started)? > > -- > Jean-Sébastien Pédron >