[PATCH] D123010: [asan] Emit .size directive for global object size before redzone

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 10:22:20 PDT 2022


abrachet abandoned this revision.
abrachet added a comment.

Hi folks wanted to update here why this was breaking.

When we decreased the size non-pie's needed a copy relocation, part of the intention here was to make them smaller. In these cases the linker would have only created enough space based on the st_size of the object. Which just became too small. The caveat here, is alignment if you have sufficient alignment you may have enough space for the object and it's redzone. This is of course not guaranteed, except for small objects where the alignment is likely to fit both. What ended up happening was objects being placed too close together and being in the redzone of the previous object.

As for gcc's implementation, they use the smaller st_size, the difference is the array they pass to __asan_register_globals is a .Lsymbol, generating relative relocations to the globals this is as if you passed `-mllvm -asan-use-private-alias` to clang. In the non-pie case, gcc is registering the global in the shared object which got preempted by the one in the executable and poisoning nothing. I doubt this behavior is intended on their end.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123010/new/

https://reviews.llvm.org/D123010



More information about the llvm-commits mailing list