From owner-svn-src-all@FreeBSD.ORG Wed Aug 20 14:41:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8642E72C; Wed, 20 Aug 2014 14:41:16 +0000 (UTC) Received: from mail-we0-x230.google.com (mail-we0-x230.google.com [IPv6:2a00:1450:400c:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A38C436BC; Wed, 20 Aug 2014 14:41:15 +0000 (UTC) Received: by mail-we0-f176.google.com with SMTP id q58so7994644wes.21 for ; Wed, 20 Aug 2014 07:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=5RjyW+wPVHHf+Ld5koroAYnTim2QFGZty3136j+dA4w=; b=BMWAnvtziqA/jz7jvM3rjm94w1z5Gj9Zx09xM2VP0LXIRew/OTaj3f2mLLWBURs8jX +egu412iyDmxiAqgteZlZ5Zqbn91FaebshGeIHarDS18CFeE29lRoDhW59lzRQWVITlO tjkT+wavQewxPVmFaEW9p1CgIsw845DIKwIvmvkkxYIUCNa3wM3Trs9JHreZkOlmhuXR w0nDgGRxlfEIQ/aXGmsEM/df0EyphmwT6+pMvKYa/N7Gy80yEF8aNvMBezqKOHmYJ16p 4HkwvWJ0hKGMuo0n0AwmQL+SKPGHjkOwngzHlKo29YaztAK8hfYcGqQW/srBlye2icWB E9Hw== X-Received: by 10.180.95.135 with SMTP id dk7mr15467382wib.68.1408545673854; Wed, 20 Aug 2014 07:41:13 -0700 (PDT) Received: from [172.16.1.30] (39.Red-2-136-52.dynamicIP.rima-tde.net. [2.136.52.39]) by mx.google.com with ESMTPSA id za9sm43323345wjc.29.2014.08.20.07.41.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Aug 2014 07:41:12 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Message-ID: <53F4B381.5010205@FreeBSD.org> Date: Wed, 20 Aug 2014 16:41:05 +0200 From: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r265003 - head/secure/usr.sbin/sshd References: <201404270528.s3R5SEIm054377@svn.freebsd.org> In-Reply-To: <201404270528.s3R5SEIm054377@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 14:41:16 -0000 On 27/04/14 07:28, Konstantin Belousov wrote: > Author: kib > Date: Sun Apr 27 05:28:14 2014 > New Revision: 265003 > URL: http://svnweb.freebsd.org/changeset/base/265003 > > Log: > Fix order of libthr and libc in the global dso list for sshd, by > explicitely linking main binary with -lpthread. Before, libthr > appeared in the list due to dependency of one of the kerberos libs. > Due to the change in ld(1) behaviour of not copying NEEDED entries > from direct dependencies into the link results, the order becomes > reversed. > > The libthr must appear before libc to properly interpose libc symbols > and provide working rtld locks implementation. The symptom was sshd > hanging on rtld bind lock during nested symbol binding from a signal > handler. > > Approved by: des (openssh maintainer) > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/secure/usr.sbin/sshd/Makefile > > Modified: head/secure/usr.sbin/sshd/Makefile > ============================================================================== > --- head/secure/usr.sbin/sshd/Makefile Sun Apr 27 05:19:01 2014 (r265002) > +++ head/secure/usr.sbin/sshd/Makefile Sun Apr 27 05:28:14 2014 (r265003) > @@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED > DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ} > LDADD+= -lcrypt -lcrypto -lz > > +# Fix the order of NEEDED entries for libthr and libc. The libthr > +# needs to interpose libc symbols, leaving the libthr loading as > +# dependency of krb causes reversed order and broken interposing. Put > +# the threading library last on the linker command line, just before > +# the -lc added by a compiler driver. > +.if ${MK_KERBEROS_SUPPORT} != "no" > +DPADD+= ${LIBPTHREAD} > +LDADD+= -lpthread > +.endif > + > .if defined(LOCALBASE) > CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\" > .endif Hello, This change makes the following simple test program fail on the second assert. The problem is that sa_handler == SIG_DFL, and sa_flags == SA_SIGINFO, which according to the sigaction(9) man page is not possible. With this change reverted the test is successful. --- #include #include #include int main(int argn, char **argv) { struct sigaction new, old; int rc; memset(&new, 0, sizeof(new)); memset(&old, 0, sizeof(old)); sigemptyset(&new.sa_mask); new.sa_handler = SIG_DFL; new.sa_flags = 0; rc = sigaction(SIGCHLD, &new, &old); assert(rc == 0); assert((old.sa_handler == SIG_DFL || old.sa_handler == SIG_IGN) && !(old.sa_flags & SA_SIGINFO)); return (0); }