google / sanitizers

AddressSanitizer, ThreadSanitizer, MemorySanitizer
Other
11.45k stars 1.03k forks source link

ASan changes ABI of shared libs #619

Open ygribov opened 8 years ago

ygribov commented 8 years ago

ASan changes size of global variables by appending redzone size to it. This may cause runtime errors when/if other shared modules have been linked against non-sanitized version of the library.

Here is an example:

$ cat tmp.c
char xxx = 0;
$ clang tmp.c -shared -fPIC
$ readelf -sDW a.out  | grep xxx
    8   0: 0000000000201034     1 OBJECT  GLOBAL DEFAULT  21 xxx
$ clang tmp.c -shared -fPIC -fsanitize=address
$ readelf -sDW a.out  | grep xxx
   11   0: 00000000002010a0    64 OBJECT  GLOBAL DEFAULT  23 xxx

So perhaps we could come up with a less invasive way to fix sanitization of globals on Mac?

ygribov commented 8 years ago

ASan changes size of global variables by appending redzone size to it.

Forgot to mention that this means ABI change.

kcc commented 8 years ago

None of us is working on it right now. Suggestions/patches are welcome.