[llvm-commits] [compiler-rt] r162834 - in /compiler-rt/trunk/lib/sanitizer_common: sanitizer_common.h sanitizer_printf.cc sanitizer_stacktrace.cc

Kostya Serebryany kcc at google.com
Wed Aug 29 01:54:43 PDT 2012


On Wed, Aug 29, 2012 at 12:50 PM, Dmitry Vyukov <dvyukov at google.com> wrote:

> On Wed, Aug 29, 2012 at 12:40 PM, Kostya Serebryany <kcc at google.com>wrote:
>
>> Author: kcc
>> Date: Wed Aug 29 03:40:36 2012
>> New Revision: 162834
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=162834&view=rev
>> Log:
>> [asan/tsan] use InternalScopedBuffer instead of stack arrays. Use mmap
>> inseted of InternalAlloc in InternalScopedBuffer
>>
>> Modified:
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=162834&r1=162833&r2=162834&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Wed Aug 29
>> 03:40:36 2012
>> @@ -55,15 +55,17 @@
>>
>>  // InternalScopedBuffer can be used instead of large stack arrays to
>>  // keep frame size low.
>> +// FIXME: use InternalAlloc instead of MmapOrDie once
>> +// InternalAlloc is made libc-free.
>>  template<typename T>
>>  class InternalScopedBuffer {
>>   public:
>>    explicit InternalScopedBuffer(uptr cnt) {
>>      cnt_ = cnt;
>> -    ptr_ = (T*)InternalAlloc(cnt * sizeof(T));
>> +    ptr_ = (T*)MmapOrDie(cnt * sizeof(T), "InternalScopedBuffer");
>>
>
>
> Please make it using malloc again. It was always intended to be
> "scoped-malloc" and extensively used in tsan.
>
>
We can not use libc malloc in asan and should not use it in tsan either.
So, we either need to have two variants of InternalScopedBuffer, or we need
to fix InternalAlloca to not depend on libc.
The former is simpler, the latter is better.
Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120829/c74492ca/attachment.html>


More information about the llvm-commits mailing list