[PATCH] Add ASan hooks to BumpPtrAllocator

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 14:03:02 PST 2015


Thanks for taking this on.  I got stuck at the clang error it found.

LGTM, as it looks like you’ve fixed it the way Alexey requested in phab.

Thanks,
Pete
> On Dec 7, 2015, at 1:28 PM, Justin Bogner <mail at justinbogner.com> wrote:
> 
> (resending to correct list)
> 
> Alexey Samsonov <vonosmas at gmail.com> writes:
>> ================
>> Comment at: include/llvm/Support/Allocator.h:229
>> @@ +228,3 @@
>> +      // Similarly, tell ASan about this space.
>> +#if LLVM_ADDRESS_SANITIZER_BUILD
>> +      ASAN_UNPOISON_MEMORY_REGION(AlignedPtr, Size);
>> ----------------
>> kcc wrote:
>>> I don't like so many ifdefs. 
>>> Maybe like this? 
>>> 
>>> #if LLVM_ADDRESS_SANITIZER_BUILD
>>> # include ... 
>>> #else
>>>  #define ASAN_POISON_MEMORY_REGION(a,b)  /*empty*/
>>> #endif
>> In fact, it's worth defining this macro in llvm/Support/Compiler.h,
>> similar to what we do for MSan interface function
>> `__msan_allocated_memory`
> 
> I was trying this out to see if it would catch a bug I saw, and happened
> to clean it up to be more like we do the msan annotations. Okay to
> commit the attached version?
> 
> <asan-bpa.patch>



More information about the llvm-commits mailing list