[PATCH] D14979: [asan] Correctly release memory allocated during early startup.
Yury Gribov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 25 23:13:14 PST 2015
ygribov added inline comments.
================
Comment at: lib/asan/asan_malloc_linux.cc:33
@@ +32,3 @@
+static bool IsInCallocPool(const void *ptr) {
+ sptr off = (sptr)ptr - (sptr)calloc_memory_for_dlsym;
+ return 0 <= off && off < (sptr)kCallocPoolSize;
----------------
Right, shame on me. This worked because ptr was equal to calloc_memory_for_dlsym.
================
Comment at: lib/asan/asan_malloc_linux.cc:74
@@ +73,3 @@
+ uptr offset = (uptr)calloc_memory_for_dlsym - (uptr)ptr;
+ uptr copy_size = Min(size, kCallocPoolSize - offset);
+ void *new_ptr = asan_malloc(size, &stack);
----------------
Sure, but is it worth it? We do not expect pool pointers to sneak into normal allocator very often.
================
Comment at: test/asan/TestCases/Linux/calloc-preload.c:11
@@ +10,3 @@
+// REQUIRES: not-android
+
+#include <stdio.h>
----------------
That's Evgeniy's code, also used in other tests. Perhaps fix this in separate commit?
http://reviews.llvm.org/D14979
More information about the llvm-commits
mailing list