Skip to content

Instantly share code, notes, and snippets.

@khakimov
Created December 3, 2012 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khakimov/4198302 to your computer and use it in GitHub Desktop.
Save khakimov/4198302 to your computer and use it in GitHub Desktop.
stack_protection
0x0000000100000eb0 <test_function+0>: push %rbp
0x0000000100000eb1 <test_function+1>: mov %rsp,%rbp
0x0000000100000eb4 <test_function+4>: mov %edi,-0x4(%rbp)
0x0000000100000eb7 <test_function+7>: mov %esi,-0x8(%rbp)
0x0000000100000eba <test_function+10>: mov %edx,-0xc(%rbp)
0x0000000100000ebd <test_function+13>: mov %ecx,-0x10(%rbp)
0x0000000100000ec0 <test_function+16>: movl $0xb,-0x20(%rbp)
0x0000000100000ec7 <test_function+23>: movb $0x41,-0x1a(%rbp)
0x0000000100000ecb <test_function+27>: pop %rbp
0x0000000100000ecc <test_function+28>: retq
Dump of assembler code for function test_function:
0x0000000100000e70 <test_function+0>: push %rbp
0x0000000100000e71 <test_function+1>: mov %rsp,%rbp
0x0000000100000e74 <test_function+4>: sub $0x30,%rsp
0x0000000100000e78 <test_function+8>: mov 0x1b9(%rip),%rax # 0x100001038
>>>> 0x7fff76556f60 <__stack_chk_guard>: 0x7c73fc21
x $rip + 0x1b9 = 0x100001038 address in memory
(gdb) x/2w 0x100001038
0x100001038: 0x76556f60 0x00007fff
(gdb) x 0x00007fff76556f60
0x7fff76556f60 <__stack_chk_guard>: 0x7c73fc21
0x0000000100000e7f <test_function+15>: mov (%rax),%rax
0x0000000100000e82 <test_function+18>: mov %rax,-0x8(%rbp)
0x0000000100000e86 <test_function+22>: mov %edi,-0xc(%rbp)
0x0000000100000e89 <test_function+25>: mov %esi,-0x10(%rbp)
0x0000000100000e8c <test_function+28>: mov %edx,-0x14(%rbp)
0x0000000100000e8f <test_function+31>: mov %ecx,-0x18(%rbp)
0x0000000100000e92 <test_function+34>: movl $0xb,-0x28(%rbp)
0x0000000100000e99 <test_function+41>: movb $0x41,-0x22(%rbp)
0x0000000100000e9d <test_function+45>: mov 0x194(%rip),%rax # 0x100001038
0x0000000100000ea4 <test_function+52>: mov (%rax),%rax
0x0000000100000ea7 <test_function+55>: mov -0x8(%rbp),%rcx
0x0000000100000eab <test_function+59>: cmp %rcx,%rax
0x0000000100000eae <test_function+62>: jne 0x100000eb6 <test_function+70>
0x0000000100000eb0 <test_function+64>: add $0x30,%rsp
0x0000000100000eb4 <test_function+68>: pop %rbp
0x0000000100000eb5 <test_function+69>: retq
0x0000000100000eb6 <test_function+70>: callq 0x100000efe <dyld_stub___stack_chk_fail>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment