Verify drx state restoration for scatter/gather expansion with other instrumentation
drx_restore_state_scatter_gather
performs state restoration for blocks containing the scatter/gather expansion using various state machines. As noted by this comment, https://github.com/DynamoRIO/dynamorio/blob/6d84fea04a036038db5a3af2e979e77d2cd356c0/ext/drx/drx.c#L2540 there may be issues in this due to other instrumentation added by clients. In addition to the cases described there, there could be instrumentation added by clients that use gpr_scratch_index
and pass this check: https://github.com/DynamoRIO/dynamorio/blob/6d84fea04a036038db5a3af2e979e77d2cd356c0/ext/drx/drx.c#L3298, e.g. loads/stores that use the mcontext base are not recognised by instr_is_reg_spill_or_restore
, and also load of the mcontext base itself is not recognised by instr_is_reg_spill_or_restore
after PR #5000 .
This issue is to investigate those cases and make this logic more robust if needed. One of the ideas is what's mentioned in the comment there already: use emulation labels in passed down instruction list (#3801) to make it easier to recognise the scatter/gather expansion instrs.