HexHive / retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Other
664 stars 77 forks source link

Load widening #6

Closed andreafioraldi closed 4 years ago

andreafioraldi commented 4 years ago

Hi, this is not an issue but a question. How do you handle binaries that perform load widening? ASAN fix this problem simply partially disabling this optimization, I'm curious about how retrowrite solved this issue at binary level.

Thank you :)

gannimo commented 4 years ago

The instrumentation is based on the observed instructions, i.e., if our Retro-Write ASan pass observes an 8 byte load, it instruments an 8-byte load. At the assembly level, the information about widening is not available and can therefore not be checked for. If the compiler did unsafe widening and the instruction reads garbage bytes past the end of the buffer, then it would detect it as error.

Please reopen if you have more questions :)