[compiler-rt] r183218 - [asan] Fix invalid thread registry access when checking if LSan is disabled.

Alexander Potapenko glider at google.com
Tue Jun 4 09:10:23 PDT 2013


Should we mark the memory as directly leaked if t is NULL?

On Tue, Jun 4, 2013 at 2:39 PM, Sergey Matveev <earthdok at google.com> wrote:
> Author: smatveev
> Date: Tue Jun  4 05:39:24 2013
> New Revision: 183218
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183218&view=rev
> Log:
> [asan] Fix invalid thread registry access when checking if LSan is disabled.
>
> Modified:
>     compiler-rt/trunk/lib/asan/asan_allocator2.cc
>
> Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=183218&r1=183217&r2=183218&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Tue Jun  4 05:39:24 2013
> @@ -422,8 +422,10 @@ static void *Allocate(uptr size, uptr al
>      uptr fill_size = Min(size, (uptr)fl.max_malloc_fill_size);
>      REAL(memset)(res, fl.malloc_fill_byte, fill_size);
>    }
> -  m->lsan_tag =
> -      t->lsan_disabled() ? __lsan::kSuppressed : __lsan::kDirectlyLeaked;
> +  if (t && t->lsan_disabled())
> +    m->lsan_tag = __lsan::kSuppressed;
> +  else
> +    m->lsan_tag = __lsan::kDirectlyLeaked;
>    // Must be the last mutation of metadata in this function.
>    atomic_store((atomic_uint8_t *)m, CHUNK_ALLOCATED, memory_order_release);
>    ASAN_MALLOC_HOOK(res, size);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list