[PATCH] D20235: [asan] Fix asan initialization failure with newer (2.23+) glibc in use.
Yury Gribov via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 07:42:37 PDT 2016
ygribov added inline comments.
================
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 const uptr kDlsymAllocPoolSize = 2048;
+static uptr allocated;
----------------
Why push up the const? BTW sad we don't have "cold" attribute for globals...
================
Comment at: lib/asan/asan_malloc_linux.cc:34
@@ +33,3 @@
+static bool IsInDlsymAllocPool(const void *ptr) {
+ sptr off = (sptr)ptr - (sptr)alloc_memory_for_dlsym;
+ return 0 <= off && off < (sptr)kDlsymAllocPoolSize;
----------------
What about overflow? That's bug in original code but anyhow...
================
Comment at: lib/asan/asan_malloc_linux.cc:35
@@ +34,3 @@
+ sptr off = (sptr)ptr - (sptr)alloc_memory_for_dlsym;
+ return 0 <= off && off < (sptr)kDlsymAllocPoolSize;
+}
----------------
Should this be s/kDlsymAllocPoolSize/sizeof(alloc_memory_for_dlsym)/ ? Also probably no need to compare with 0?
================
Comment at: lib/asan/asan_malloc_linux.cc:39
@@ +38,3 @@
+static void *AllocateFromLocalPool(uptr size_in_bytes) {
+ uptr size_in_words = (size_in_bytes + kWordSize - 1) / kWordSize;
+ void *mem = (void*)&alloc_memory_for_dlsym[allocated];
----------------
RoundUpTo?
Repository:
rL LLVM
http://reviews.llvm.org/D20235
More information about the llvm-commits
mailing list