- 论坛徽章:
- 0
|
一些分析,我怀疑是printf传参导致寄存器esi出了问题。
错误信息如下:
root@ubuntu:~/test# gdb ./stack_test
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/test/stack_test...(no debugging symbols found)...done.
(gdb) r
Starting program: /root/test/stack_test
hello
Program received signal SIGSEGV, Segmentation fault.
0xb7ff37d5 in allocate_dtv (mem=0x6) at dl-tls.c:310
310 dl-tls.c: No such file or directory.
in dl-tls.c
(gdb) info registers
eax 0x804b010 134524944
ecx 0x0 0
edx 0x0 0
ebx 0xb7ffeff4 -1207963660
esp 0xbffff3e4 0xbffff3e4
ebp 0xbffff3f8 0xbffff3f8
esi 0x6 6
edi 0xf 15
eip 0xb7ff37d5 0xb7ff37d5 <_dl_allocate_tls+69>
eflags 0x210212 [ AF IF RF ID ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
00011790 <_dl_allocate_tls>:
11790: 55 push %ebp
11791: 89 e5 mov %esp,%ebp
11793: 83 ec 14 sub $0x14,%esp
11796: 89 5d f4 mov %ebx,-0xc(%ebp)
11799: e8 cd 5e 00 00 call 1766b <calloc+0x20bb>
1179e: 81 c3 56 b8 00 00 add $0xb856,%ebx
117a4: 85 c0 test %eax,%eax
117a6: 89 75 f8 mov %esi,-0x8(%ebp)
117a9: 89 c6 mov %eax,%esi
117ab: 89 7d fc mov %edi,-0x4(%ebp)
117ae: 74 48 je 117f8 <_dl_allocate_tls+0x68>
117b0: 8b 83 34 08 00 00 mov 0x834(%ebx),%eax
117b6: c7 44 24 04 08 00 00 movl $0x8,0x4(%esp)
117bd: 00
117be: 8d 78 0e lea 0xe(%eax),%edi
117c1: 83 c0 10 add $0x10,%eax
117c4: 89 04 24 mov %eax,(%esp)
117c7: e8 20 f0 fe ff call 7ec <calloc@plt>
117cc: 85 c0 test %eax,%eax
117ce: 74 20 je 117f0 <_dl_allocate_tls+0x60>
117d0: 89 38 mov %edi,(%eax)
117d2: 83 c0 08 add $0x8,%eax
117d5: 89 46 04 mov %eax,0x4(%esi)
117d8: 8b 5d f4 mov -0xc(%ebp),%ebx
117db: 89 f0 mov %esi,%eax
117dd: 8b 7d fc mov -0x4(%ebp),%edi
117e0: 8b 75 f8 mov -0x8(%ebp),%esi |
|