|
|
|
|
|
by jonathrg
917 days ago
|
|
Indeed. Typically you have pairs of call and ret, where call creates a stack frame and ret tears it down caller caller
| ^
(call) . . . . . . . . . . . . . (ret)
| |
V |
outer_function outer_function
| ^
(call) . . . .(ret)
| |
V |
inner_function
A jmp does not modify the stack, so when the inner function calls ret it jumps right back to caller caller caller
| ^
(call) . . . . . . (ret)
| |
v |
outer_function |
| |
(jmp) |
| |
V |
inner_function
This trick stops working as soon as outer_function needs local variables or does anything other than returning the exact return value of inner_function. In that case you need a stack frame |
|