selfrando icon indicating copy to clipboard operation
selfrando copied to clipboard

Preserve function alignment on Win64

Open ahomescu opened this issue 7 years ago • 0 comments

We do not preserve the function alignments specified in the object files. Function shuffling on Win64 can put a function at any address inside .text, including odd ones.

We do have the implementation in place to preserve function alignment (by adding padding before each function during randomization), but enabling it causes code section overflows on some binaries (mainly freebl3.dll in Firefox). We should add some additional padding space to .text to avoid overflows, but we need to figure out how much.

The most conservative solution would be to add alignment(function) - 1 bytes to the end of each function, but that could be wasteful (current overflows are only by a few tens or hundreds of bytes). Alternatively, we could add a small, fixed amount of padding, but that wouldn't guarantee that randomization never overflows.

ahomescu avatar Mar 03 '17 03:03 ahomescu