[PATCH] D33784: Bug 33206 - Sanitizer CHECK failed: ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (1036, 1024)) with preload

Maxim Ostapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 14:05:22 PDT 2017


m.ostapenko added inline comments.


================
Comment at: lib/asan/asan_malloc_linux.cc:88
+    void *new_ptr = LIKELY(asan_inited) ? asan_malloc(size, &stack)
+                                        : AllocateFromLocalPool(size);
     internal_memcpy(new_ptr, ptr, copy_size);
----------------
eugenis wrote:
> This is fixing another, unrelated bug - right? In the case of realloc() from the dlsym pool to the regular allocator we may read past the end of the pool.
> 
> Also, this does not fix the original problem - all reallocs are served from the pool until asan is initialized. Realloc should force asan initialization the same as other interceptors.
> 
> This is fixing another, unrelated bug - right? In the case of realloc() from the dlsym pool to the regular allocator we may read past the end of the pool.

Right. Besides that, current code looks scruffy so why not refactor?

> Also, this does not fix the original problem - all reallocs are served from the pool until asan is initialized. Realloc should force asan initialization the same as other interceptors.

Yeah, at least realloc(NULL, ...) behaves like malloc and needs to be handled accordingly.


https://reviews.llvm.org/D33784





More information about the llvm-commits mailing list