[compiler-rt] r222885 - [Msan] Fix some interceptors to pass initialization on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Nov 27 06:28:58 PST 2014


Author: vkutuzov
Date: Thu Nov 27 08:28:57 2014
New Revision: 222885

URL: http://llvm.org/viewvc/llvm-project?rev=222885&view=rev
Log:
[Msan] Fix some interceptors to pass initialization on FreeBSD
Differential Revision: http://reviews.llvm.org/D6417

Modified:
    compiler-rt/trunk/lib/msan/msan_interceptors.cc

Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=222885&r1=222884&r2=222885&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Thu Nov 27 08:28:57 2014
@@ -266,6 +266,8 @@ INTERCEPTOR(void, malloc_stats, void) {
 #endif
 
 INTERCEPTOR(SIZE_T, strlen, const char *s) {
+  if (msan_init_is_running)
+    return REAL(strlen)(s);
   ENSURE_MSAN_INITED();
   SIZE_T res = REAL(strlen)(s);
   CHECK_UNPOISONED(s, res + 1);
@@ -636,6 +638,8 @@ INTERCEPTOR(char *, fcvt, double x, int
 }
 
 INTERCEPTOR(char *, getenv, char *name) {
+  if (msan_init_is_running)
+    return REAL(getenv)(name);
   ENSURE_MSAN_INITED();
   char *res = REAL(getenv)(name);
   if (res) __msan_unpoison(res, REAL(strlen)(res) + 1);
@@ -961,6 +965,8 @@ void __msan_allocated_memory(const void*
 
 INTERCEPTOR(void *, mmap, void *addr, SIZE_T length, int prot, int flags,
             int fd, OFF_T offset) {
+  if (msan_init_is_running)
+    return REAL(mmap)(addr, length, prot, flags, fd, offset);
   ENSURE_MSAN_INITED();
   if (addr && !MEM_IS_APP(addr)) {
     if (flags & map_fixed) {





More information about the llvm-commits mailing list