DynamoRIO / DynamoRIO/dynamorio
atomic_ operations not safe from compiler optimizations
Open
Bug-AppFail
Bug-Hang
OpSys-x64
OpSys-x86
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
I don't have/know of any test or app that exposes this. In particular, looking at objdump currently - at least on my machine - the compiler doesn't take advantage of the hole. Currently, we C-code
ATOMIC_OP (e.g. inc, compare/exchange etc.)
SET (flag operation)
Both statements are "asm volatile". Theoretically, the compiler is allowed to move flag modifying instructions in between the statements. To fix, we need to either
* move all instructions into the same asm volatile statement
OR
* at least add "cc" clobber to both asm volatile statements (and I would add "memory" to both as well).
Contributor guide
Assessment
This issue has not been assessed yet.