WCU / Cybersecurity
~/CSC 471/Class 02/KP 14
Class 02 · KP 14 / 23

Stack, Call, and Return

push rax     ; rsp -= 8 ; [rsp] = rax
pop  rbx     ; rbx = [rsp] ; rsp += 8

call func    ; push return address, then jmp func
ret          ; pop return address into rip
  • The stack grows downward (toward lower addresses).
  • call saves where to come back to; ret returns there.
  • Overwriting a saved return address on the stack = classic stack buffer overflow.