[PATCH] D20235: [asan] Fix asan initialization failure with newer (2.23+) glibc in use.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Fri May 13 08:02:33 PDT 2016


m.ostapenko 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;
----------------
ygribov wrote:
> Why push up the const? BTW sad we don't have "cold" attribute for globals...
No particular reason actually, just was afraid 1024 is not enough.

================
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;
----------------
ygribov wrote:
> What about overflow? That's bug in original code but anyhow...
Yeah, we need use uptr instead and check:

1) ptr >= alloc_memory_for_dlsym
2) (ptr - alloc_memory_for_dlsym) < sizeof(alloc_memory_for_dlsym)


Repository:
  rL LLVM

http://reviews.llvm.org/D20235





More information about the llvm-commits mailing list