[PATCH] D20235: [asan] Fix asan initialization failure with newer (2.23+) glibc in use.
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 10:15:33 PDT 2016
kcc added a comment.
Mostly LGTM.
It's sad we need to do this, looks like we have to...
Thanks!
================
Comment at: lib/asan/asan_malloc_linux.cc:29
@@ -28,3 +28,3 @@
-static const uptr kCallocPoolSize = 1024;
-static uptr calloc_memory_for_dlsym[kCallocPoolSize];
+static uptr allocated;
+static const uptr kDlsymAllocPoolSize = 1024;
----------------
Please use a more descriptive name, e.g. allocated_for_dlsym
================
Comment at: lib/asan/asan_malloc_linux.cc:35
@@ +34,3 @@
+ if (uptr(ptr) < (uptr)alloc_memory_for_dlsym)
+ return false;
+ uptr off = (uptr)ptr - (uptr)alloc_memory_for_dlsym;
----------------
You can do a range check using unsigned arithmetic and just one compare.
================
Comment at: lib/asan/asan_malloc_linux.cc:44
@@ +43,3 @@
+ allocated += size_in_words;
+ CHECK(allocated < kDlsymAllocPoolSize);
+ return mem;
----------------
replace with CHECK_LT, while you are at it
Repository:
rL LLVM
http://reviews.llvm.org/D20235
More information about the llvm-commits
mailing list