Last active
October 14, 2018 15:36
-
-
Save chrepl/682adaf22e84b4c2a82f48293acad51d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int recursive(); | |
int main() | |
{ | |
puts("call recursive()"); | |
asm ( | |
"call _recursive" | |
); | |
// never reached | |
return 0; | |
} | |
asm ( | |
".intel_syntax noprefix \n" | |
"_recursive: \n" | |
// " push rbp \n" // uncomment this to get an segfault | |
" mov rbp, rsp \n" | |
" jmp _recursive \n" // jmp not call - call saves ret to stack - change jmp to call will get an segfault to | |
" xor eax, eax \n" // never reached | |
" pop rbp \n" | |
" ret \n" // if reached should segfault | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment