svn commit: r265003 - head/secure/usr.sbin/sshd

Konstantin Belousov kib at
Sun Apr 27 05:28:14 UTC 2014

Author: kib
Date: Sun Apr 27 05:28:14 2014
New Revision: 265003

  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
  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
  Approved by:	des (openssh maintainer)
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week


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
 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"
+LDADD+= -lpthread
 .if defined(LOCALBASE)

More information about the svn-src-head mailing list