Skip to main content

dr_clobber_retaddr_after_read

Function dr_clobber_retaddr_after_read 

Source
pub unsafe extern "C" fn dr_clobber_retaddr_after_read(
    drcontext: *mut c_void,
    ilist: *mut instrlist_t,
    instr: *mut instr_t,
    value: ptr_uint_t,
) -> bool_
Expand description

Causes DynamoRIO to insert code that stores \p value into the return address slot on the stack immediately after the original value is read by the return instruction \p instr. \p instr must be a return instruction or this routine will fail.

On ARM, \p value is ignored and instead a value that is guaranteed to not look like a return address is used. This is for efficiency reasons, as on ARM it would require an extra register spill in order to write an arbitrary value.

\note This is meant to make it easier to obtain efficient callstacks by eliminating stale return addresses from prior stack frames. However, it is possible that writing to the application stack could result in incorrect application behavior, so use this at your own risk.

\return whether successful.