Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. int test(int a)
  2. {
  3. return a;
  4. }
  5.  
  6. movl %edi, -20(%rbp) ; save function parameter onto stack (unrelated to canary)
  7. movq __stack_chk_guard(%rip), %rax ; load magic value into EAX register
  8. movq %rax, -8(%rbp) ; save EAX register onto stack (place the canary)
  9. movl -20(%rbp), %eax ; load function parameter into EAX register for return (unrelated to canary)
  10. movq -8(%rbp), %rcx ; load canary value into RCX register
  11. movq __stack_chk_guard(%rip), %rdx ; load magic value into RDX register
  12. cmpq %rdx, %rcx ; compare canary value to expected value
  13. je .L3 ; if they are the same, jump to label .L3 (continue)
  14. call __stack_chk_fail ; otherwise (stack corruption detected), call the handler
  15. .L3:
  16. leave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement