CALL
Table of Contents
CALL (call)
Basic purpose
CALL is used to invoke a function by jumping to the target location to execute code while saving the return address so execution can return to the call site when the function finishes.
Instruction execution process
-
Push the address of the instruction following the current instruction (the return address) onto the stack
-
Set RIP to the call target address
-
Begin executing the new code path
Equivalent behavior (x64):
push rip_nextjmp targetInstruction formats
call rel32 ; 相对调用(最常见)
call rax ; 寄存器间接调用
call [rax] ; 内存间接调用
call qword ptr [...] ; 绝对调用Behavioral characteristics
-
Modifies RSP (pushes the return address)
-
Modifies RIP (jumps)
-
Does not modify EFLAGS
-
Changes to the stack structure have a major impact on PWN
-
An important node for constructing ROP chains and hijacking control flow
Common uses
-
Calling functions
-
Dynamically resolving function addresses (via the call/pop technique)
-
Control-flow obfuscation (using call to enter an intermediate stub)
-
Changing the return address during overflow exploitation