Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libasan broken again via import of gcc 5.4 (Re: gcc 5.3 version of libasan is broken)



On 2016/06/07 22:49, Rin Okuyama wrote:
I did not test on GCC 5.4. But I suppose that it should work because
no syscall-related changes were made for libsanitizer.

However, libasan gets broken again via import of gcc 5.4:

  % uname -mpr
  7.99.30 amd64 x86_64
  % cc -fsanitize=address hello.c
  % ./a.out
  ==13918==Sanitizer CHECK failed: /var/build/src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc:40 ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (9088, 1024)

It happens regardless of whether my patch is applied or not. This is due to
a change to asan_malloc_linux.cc:

  http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc#rev1.4

It is a workaround for glibc, by which asan_malloc() fails into infinite
recursion of AsanInitInternal():

  http://reviews.llvm.org/rL269633

It is actually irrelevant to us; so simply disable it. Then, libasan
becomes sane again.

Thanks,
Rin
====
--- src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc.orig	2016-06-09 18:40:25.793171873 +0900
+++ src/external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc	2016-06-09 18:51:57.279961291 +0900
@@ -56,9 +56,15 @@
 }
INTERCEPTOR(void*, malloc, uptr size) {
+#if SANITIZER_NETBSD
+// This is a workaround for glibc, by which asan_malloc() fails into infinite
+// recursion of AsanInitInternal(): http://reviews.llvm.org/rL254395
+// It is irrelevant to us, rather causes abort due to shortage of buffer.
+#else
   if (UNLIKELY(!asan_inited))
     // Hack: dlsym calls malloc before REAL(malloc) is retrieved from dlsym.
     return AllocateFromLocalPool(size);
+#endif
   GET_STACK_TRACE_MALLOC;
   return asan_malloc(size, &stack);
 }


Home | Main Index | Thread Index | Old Index