Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGP1gyM8RjwT6YOk0iEGL_T_Ykk=XhpLtjTyyBoRtSyHXCC4BA@mail.gmail.com>
Date: Thu, 5 Oct 2023 14:26:42 -0400
From: Carl Chave <online@...ve.us>
To: musl@...ts.openwall.com, Carl Chave <online@...ve.us>, Rich Felker <dalias@...c.org>
Subject: Re: Hung processes with althttpd web server

> apk add musl-dbg
>
> the bt should be more useful then.

(gdb) bt
#0  __syscall_cp_c (nr=202, u=140049023633540, v=128, w=-2147483632,
x=0, y=0, z=0) at ./arch/x86_64/syscall_arch.h:61
#1  0x00007f5fb449b6c9 in __futex4_cp (to=0x0, val=-2147483632,
op=128, addr=0x7f5fb44e0884 <init_fini_lock+4>) at
src/thread/__timedwait.c:24
#2  __timedwait_cp (addr=addr@...ry=0x7f5fb44e0884 <init_fini_lock+4>,
val=val@...ry=-2147483632, clk=clk@...ry=0, at=at@...ry=0x0,
priv=priv@...ry=128) at src/thread/__timedwait.c:52
#3  0x00007f5fb449b76e in __timedwait (addr=addr@...ry=0x7f5fb44e0884
<init_fini_lock+4>, val=-2147483632, clk=clk@...ry=0, at=at@...ry=0x0,
priv=priv@...ry=128)
    at src/thread/__timedwait.c:68
#4  0x00007f5fb449d9b1 in __pthread_mutex_timedlock (m=0x7f5fb44e0880
<init_fini_lock>, at=at@...ry=0x0) at
src/thread/pthread_mutex_timedlock.c:85
#5  0x00007f5fb449d7c0 in __pthread_mutex_lock
(m=m@...ry=0x7f5fb44e0880 <init_fini_lock>) at
src/thread/pthread_mutex_lock.c:9
#6  0x00007f5fb44a49ff in __libc_exit_fini () at ldso/dynlink.c:1442
#7  0x00007f5fb445b082 in exit (code=0) at src/exit/exit.c:30
#8  0x0000557471c3cf45 in ?? ()
#9  <signal handler called>
#10 0x00007f5fb43d3f20 in ?? () from /lib/libssl.so.3
#11 0x00007f5fb44a4a9d in __libc_exit_fini () at ldso/dynlink.c:1453
#12 0x00007f5fb445b082 in exit (code=0) at src/exit/exit.c:30
#13 0x0000557471c3cbe7 in ?? ()
#14 0x0000557471c3e934 in ?? ()
#15 0x0000557471c3c2d2 in ?? ()
#16 0x00007f5fb4462aad in libc_start_main_stage2 (main=0x557471c3b780,
argc=13, argv=0x7ffd0641b958) at src/env/__libc_start_main.c:95
#17 0x0000557471c3c31a in ?? ()
#18 0x000000000000000d in ?? ()
#19 0x00007ffd0641ce54 in ?? ()
#20 0x00007ffd0641ce66 in ?? ()
#21 0x00007ffd0641ce6d in ?? ()
#22 0x00007ffd0641ce6f in ?? ()
#23 0x00007ffd0641ce76 in ?? ()
#24 0x00007ffd0641ce79 in ?? ()
#25 0x00007ffd0641ce80 in ?? ()
#26 0x00007ffd0641ce89 in ?? ()
#27 0x00007ffd0641ce92 in ?? ()
#28 0x00007ffd0641cea2 in ?? ()
#29 0x00007ffd0641ceac in ?? ()
#30 0x00007ffd0641cec6 in ?? ()
#31 0x00007ffd0641cecd in ?? ()
#32 0x0000000000000000 in ?? ()

> in this case you can also look at
>
> (gdb) disas $rip-40,+80

(gdb) disas $rip-40,+80
Dump of assembler code from 0x7f5fb449c0b5 to 0x7f5fb449c105:
   0x00007f5fb449c0b5 <__syscall_cp_c+19>:    mov    %r9,%r8
   0x00007f5fb449c0b8 <__syscall_cp_c+22>:    mov    %fs:0x0,%rbp
   0x00007f5fb449c0c1 <__syscall_cp_c+31>:    movzbl 0x40(%rbp),%eax
   0x00007f5fb449c0c5 <__syscall_cp_c+35>:    mov    0x20(%rsp),%r9
   0x00007f5fb449c0ca <__syscall_cp_c+40>:    test   %eax,%eax
   0x00007f5fb449c0cc <__syscall_cp_c+42>:    je     0x7f5fb449c0df
<__syscall_cp_c+61>
   0x00007f5fb449c0ce <__syscall_cp_c+44>:    dec    %eax
   0x00007f5fb449c0d0 <__syscall_cp_c+46>:    je     0x7f5fb449c0d8
<__syscall_cp_c+54>
   0x00007f5fb449c0d2 <__syscall_cp_c+48>:    cmp    $0x3,%rbx
   0x00007f5fb449c0d6 <__syscall_cp_c+52>:    jne    0x7f5fb449c0df
<__syscall_cp_c+61>
   0x00007f5fb449c0d8 <__syscall_cp_c+54>:    mov    %rbx,%rax
   0x00007f5fb449c0db <__syscall_cp_c+57>:    syscall
=> 0x00007f5fb449c0dd <__syscall_cp_c+59>:    jmp    0x7f5fb449c12b
<__syscall_cp_c+137>
   0x00007f5fb449c0df <__syscall_cp_c+61>:    push   %r9
   0x00007f5fb449c0e1 <__syscall_cp_c+63>:    lea    0x3c(%rbp),%rax
   0x00007f5fb449c0e5 <__syscall_cp_c+67>:    mov    %rsi,%rcx
   0x00007f5fb449c0e8 <__syscall_cp_c+70>:    mov    %r10,%r9
   0x00007f5fb449c0eb <__syscall_cp_c+73>:    push   %r8
   0x00007f5fb449c0ed <__syscall_cp_c+75>:    mov    %rbx,%rsi
   0x00007f5fb449c0f0 <__syscall_cp_c+78>:    mov    %rdx,%r8
   0x00007f5fb449c0f3 <__syscall_cp_c+81>:    mov    %rdi,%rdx
   0x00007f5fb449c0f6 <__syscall_cp_c+84>:    mov    %rax,%rdi
   0x00007f5fb449c0f9 <__syscall_cp_c+87>:    call   0x7f5fb449ef4a
<__syscall_cp_asm>
   0x00007f5fb449c0fe <__syscall_cp_c+92>:    pop    %rsi
   0x00007f5fb449c0ff <__syscall_cp_c+93>:    pop    %rdi
   0x00007f5fb449c100 <__syscall_cp_c+94>:    cmp    $0xfffffffffffffffc,%rax
   0x00007f5fb449c104 <__syscall_cp_c+98>:    jne    0x7f5fb449c12b
<__syscall_cp_c+137>
End of assembler dump.

> (gdb) info reg
>

(gdb) info reg
rax            0xfffffffffffffe00  -512
rbx            0xca                202
rcx            0x7f5fb449c0dd      140049023353053
rdx            0xffffffff80000010  -2147483632
rsi            0x80                128
rdi            0x7f5fb44e0884      140049023633540
rbp            0x7f5fb44e0b48      0x7f5fb44e0b48 <builtin_tls+136>
rsp            0x7ffd06416680      0x7ffd06416680
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x246               582
r12            0x7f5fb44e0884      140049023633540
r13            0x80                128
r14            0x80                128
r15            0x0                 0
rip            0x7f5fb449c0dd      0x7f5fb449c0dd <__syscall_cp_c+59>
eflags         0x246               [ PF ZF IF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0

> since the address is the first arg to a futex syscall (rdi).
> then you can try to dig around to see where rdi points to
>
> (gdb) x/4wx $rdi-4

(gdb) x/4wx $rdi-4
0x7f5fb44e0880 <init_fini_lock>:    0x00000000    0x80000010
0x00000001    0x00000000

> (gdb) info sym $rdi
>

(gdb) info sym $rdi
init_fini_lock + 4 in section .bss of /lib/ld-musl-x86_64.so.1

Thanks for the reply and instruction.

Carl

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.