From owner-svn-src-head@FreeBSD.ORG Wed Aug 20 15:20:00 2014 Return-Path: Delivered-To: svn-src-head@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 ACF65D4D; Wed, 20 Aug 2014 15:20:00 +0000 (UTC) Received: from mail-we0-x233.google.com (mail-we0-x233.google.com [IPv6:2a00:1450:400c:c03::233]) (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 EDE8D3B98; Wed, 20 Aug 2014 15:19:59 +0000 (UTC) Received: by mail-we0-f179.google.com with SMTP id u57so8128108wes.10 for ; Wed, 20 Aug 2014 08:19:57 -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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=gPI4q+wtz0RHijTSfo6oYsIrPo8rRPGofJxhpUHNDrE=; b=n3T635OJSYSwwr3JMCy2tgPVPca/VVdC3HoutPKKoGsgjVNlOUbeP3ZqwJBfUfBAXV bvGiw9/Bg2HGTkU9YYBm2CBOx0KGmJkSMPO2GXMTu3PJgg//ZJUMyjMPaNVVcOcq1cvZ OdBb7GtUlSghk3LRm83bhWtZVOPcwpEmhqUWGHhPG0enGTdyZz8up4BlpJ7G9QkhwAPW NqpvNu29hAKbZvKZK66WuoaewztcsL51lWhwpStP+muNUTbyPs2AYnLO5Ek+VF0VHM0V ljbDIkG6iWCmuKONYauvsJDLDGV/RZ63nEkJz5XYqpZXXjmBpRiVdiQ1IwahVenUGZbf oduQ== X-Received: by 10.194.203.105 with SMTP id kp9mr61326258wjc.41.1408547997633; Wed, 20 Aug 2014 08:19:57 -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 je3sm10182930wic.11.2014.08.20.08.19.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Aug 2014 08:19:56 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Message-ID: <53F4BC9B.3090405@FreeBSD.org> Date: Wed, 20 Aug 2014 17:19:55 +0200 From: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= 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 Subject: Re: svn commit: r265003 - head/secure/usr.sbin/sshd References: <201404270528.s3R5SEIm054377@svn.freebsd.org> <53F4B381.5010205@FreeBSD.org> <20140820151310.GB2737@kib.kiev.ua> In-Reply-To: <20140820151310.GB2737@kib.kiev.ua> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 15:20:00 -0000 On 20/08/14 17:13, Konstantin Belousov wrote: > On Wed, Aug 20, 2014 at 04:41:05PM +0200, Roger Pau Monn?? wrote: >> 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. > I do not quite follow. > > What are the relations between sshd and your test program ? > Should the test be run somehow specially ? No, and frankly that's what I don't understand. I compile this simple test with `cc -o test test.c`. It fails with this commit applied, and succeeds without it. Roger.