[PATCH] D47995: [ASAN] fix startup crash in dlsym for long paths since glibc 2.27

Peter Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 03:48:11 PDT 2018


Lekensteyn added inline comments.


================
Comment at: lib/asan/asan_malloc_linux.cc:58
+  void *prev_mem = (void*)&alloc_memory_for_dlsym[prev_offset];
+  if (prev_mem == ptr) {
+    REAL(memset)(prev_mem, 0, last_dlsym_alloc_size_in_words * kWordSize);
----------------
vitalybuka wrote:
> Alternative, more general solution is to have some bitmap which tells if byte is allocated. And then trim the tail on each free.
> 
A bitmap before (or after) an allocation increases memory consumption (by a tiny amount). It would only be beneficial in the following pattern:
```
p = malloc(a); q = malloc(b);
free(q); free(p); // currently does not release "p"
// or:
//free(p); free(q); // currently does not release "p" and "q"
```

however as I have not observed these patterns and its implementation is more complex, I decided to take the current, simpler approach.


Repository:
  rL LLVM

https://reviews.llvm.org/D47995





More information about the llvm-commits mailing list