[PATCH] [ASan] Get fake stack code working with GCC 4.8.2.

Kostya Serebryany kcc at google.com
Fri Nov 14 12:04:59 PST 2014


>>! In D6266#5, @foad wrote:
>>>! In D6266#4, @kcc wrote:
>> I think that instead of adding an option to one of N supported build systems we need to make the code more compiler-resistant 
> 
> Do you mean changing the code in SetShadow? I suppose I could try adding "volatile" or something. (Yuck!)

Slightly better way is to move break_optimization from sanitizer_common/sanitizer_libc.cc
to sanitizer_common/sanitizer_common.h and use it inside the loop. 

It's not perfect either, because this will not let the compiler use wider stores. 

Ideally, I would introduce internal_memset_aligned64, similar to internal_bzero_aligned16 in sanitizer_common/sanitizer_libc.cc. 
Then for small class_id (0, 1, 2) use explicit assignments and for large ones (3, 4, 5, 6) use internal_memset_aligned64

> 
> The only other approach I can think of is for __asan_memset to detect whether it has been called from the application or from libasan itself; either by looking at the return address, or by changing every entry point in the sanitizer to set some "in asan" flag.

God forbid :)

http://reviews.llvm.org/D6266






More information about the llvm-commits mailing list