Topic 5: Stack-smashing and shellcoding Flashcards
1
Q
how does a stack grow?
A
from bottom to top, grows towards lower addresses downwards
2
Q
what is a stack pointer?
A
points to the top of the stack (its first element), usually stored in RSP/ESP
3
Q
what is a stack used for?
A
store frame pointer, store local variables, pass function arguments, temporarily store register values, return the address of caller function
4
Q
what is a stack frame?
A
includes all function-local data, starts below the return address and stops at the stack pointer
5
Q
what is a frame pointer?
A
aka base pointer, marks the highest address in the frame, commonly stored in RBP/EBP
6
Q
steps of a function call?
A
- prepare arguments
- make the call
- function prologue
- save RBP/EBP
- setup new RBP/EBP
- callee saves registers that need to be preserved
- callee allocates stack space