DynamoRIO / DynamoRIO/dynamorio
ARM stub patching is not thread-safe
Open
OpSys-ARM
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
Currently DynamoRIO on ARM (AArch32) seems to patch a stub by replacing an `STR` with an `LDR PC, [PC + offs]` (see patch_stub in arm/emit_utils.c). This is not officially safe if the code may be executed by another thread at the same time. According to section E2.6.5 of the ARM ARM only certain instructions can be safely updated in this way: B, BL, BLX, NOP, BKPT, SVC, HVC, SMC.
I do not know how likely it is that this non-conformance to the architecture specification will cause problems in practice. The current code may be perfectly safe on some hardware.
Contributor guide
Assessment
This issue has not been assessed yet.