Stuck CLOSED sockets / sshd / zombies...

Konstantin Belousov kostikbel at gmail.com
Tue Apr 8 16:43:58 UTC 2014


On Tue, Apr 08, 2014 at 04:33:03PM +0100, Karl Pielorz wrote:
> 
> 
> --On 08 April 2014 09:36 -0400 John Baldwin <jhb at freebsd.org> wrote:
> 
> > Humm, it needs to build new ones with debug symbols.  If it doesn't,
> > you'll need to do 'make clean' before the other makes.  I think you
> > should be fine to do that (make clean then the command above) for those
> > directories and restart gdb without having to restart your sshd.  Please
> > also add '/usr/src/libexec/rtld-elf' to the list of directories where you
> > do this.  Then do 'detach' in gdb, exit gdb and restart it.
> 
> Ok, it hit an issue with libc (complained it couldn't find yp.h - but I 
> fixed that) and it compiled up OK then. The rest all recompiled / installed 
> OK, and I included the rtld-elf code.
> 
> > Hmmm, that is useful even though the debug symbols aren't there.  Please
> > do the rebuilds I asked for above and re-attach gdb and get 'bt' again.
> 
> Ok, that now nets:
> 
> "
> ...
> [Switching to LWP 100218]
> 0x00000008038ea89c in __error () from /lib/libthr.so.3
> (gdb) bt
> #0  0x00000008038ea89c in __error () from /lib/libthr.so.3
> #1  0x00000008038e104f in __thr_rwlock_rdlock (rwlock=0x803af9480, 
> flags=<value optimized out>, tsp=<value optimized out>)
>     at /usr/src/lib/libthr/thread/thr_umtx.c:277
> #2  0x00000008038e821c in _thr_rtld_rlock_acquire (lock=0x803af9480) at 
> atomic.h:143
> #3  0x000000080064f9a2 in rlock_acquire (lock=0x80085fe00, 
> lockstate=0x7fffffffba68) at /usr/src/libexec/rtld-elf/rtld_lock.c:197
> #4  0x00000008006498c9 in _rtld_bind (obj=0x800662000, reloff=13008) at 
> /usr/src/libexec/rtld-elf/rtld.c:675
> #5  0x00000008006470cd in _rtld_bind_start () at 
> /usr/src/libexec/rtld-elf/amd64/rtld_start.S:99
> #6  0x0000000000000246 in ?? ()
> #7  0x0000000000000000 in ?? ()
> "

The following patch might allow to see the backtrace beyond the binder
entry point.  You might also have better luck with the gdb from ports.

diff --git a/libexec/rtld-elf/amd64/rtld_start.S b/libexec/rtld-elf/amd64/rtld_start.S
index da3d156..54ef468 100644
--- a/libexec/rtld-elf/amd64/rtld_start.S
+++ b/libexec/rtld-elf/amd64/rtld_start.S
@@ -79,17 +79,39 @@
 	.globl	_rtld_bind_start
 	.type	_rtld_bind_start, at function
 _rtld_bind_start:
+	.cfi_startproc
+	.cfi_adjust_cfa_offset	16
 	subq	$8,%rsp
+	.cfi_adjust_cfa_offset	8
 	pushfq				# Save rflags
+	.cfi_adjust_cfa_offset	8
 	pushq	%rax			# Save %rax
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%rax,-24
 	pushq	%rdx			# Save %rdx
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%rdx,-32
 	pushq	%rcx			# Save %rcx
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%rcx,-40
 	pushq	%rsi			# Save %rsi
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%rsi,-48
 	pushq	%rdi			# Save %rdi
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%rdi,-56
 	pushq	%r8			# Save %r8
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%r8,-64
 	pushq	%r9			# Save %r9
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%r9,-72
 	pushq	%r10			# Save %r10
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%r10,-80
 	pushq	%r11			# Save %r11
+	.cfi_adjust_cfa_offset 8
+	.cfi_offset	%r11,-88
 
 	movq	0x58(%rsp),%rdi		# Fetch obj argument
 	movq	0x60(%rsp),%rsi		# Fetch reloff argument
@@ -101,16 +123,37 @@ _rtld_bind_start:
 
 	movq	%rax,0x60(%rsp)		# Store target over reloff argument
 	popq	%r11			# Restore %r11
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %r11
 	popq	%r10			# Restore %r10
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %r10
 	popq	%r9			# Restore %r9
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %r9
 	popq	%r8			# Restore %r8
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %r8
 	popq	%rdi			# Restore %rdi
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %rdi
 	popq	%rsi			# Restore %rsi
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %rsi
 	popq	%rcx			# Restore %rcx
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %rcx
 	popq	%rdx			# Restore %rdx
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %rdx
 	popq	%rax			# Restore %rax
+	.cfi_adjust_cfa_offset -8
+	.cfi_restore %rax
 	popfq				# Restore rflags
+	.cfi_adjust_cfa_offset -8
 	leaq	16(%rsp),%rsp		# Discard spare, obj, do not change rflags
 	ret				# "Return" to target address
+	.cfi_endproc
+	.size	_rtld_bind_start, . - _rtld_bind_start
 
 	.section .note.GNU-stack,"",%progbits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140408/46c24462/attachment.sig>


More information about the freebsd-hackers mailing list