[PATCH] D14795: [msan] Don't unpoison phdrs on dlopen(NULL, 0)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 18 16:58:32 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253530: [msan] Don't unpoison phdrs on dlopen(NULL, 0) (authored by rnk).
Changed prior to commit:
http://reviews.llvm.org/D14795?vs=40577&id=40580#toc
Repository:
rL LLVM
http://reviews.llvm.org/D14795
Files:
compiler-rt/trunk/lib/msan/msan_interceptors.cc
compiler-rt/trunk/test/msan/dlopen_executable.cc
Index: compiler-rt/trunk/test/msan/dlopen_executable.cc
===================================================================
--- compiler-rt/trunk/test/msan/dlopen_executable.cc
+++ compiler-rt/trunk/test/msan/dlopen_executable.cc
@@ -0,0 +1,17 @@
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+#include <assert.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+
+static int my_global;
+
+int main(void) {
+ int *uninit = (int*)malloc(sizeof(int));
+ my_global = *uninit;
+ void *p = dlopen(0, RTLD_NOW);
+ assert(p && "failed to get handle to executable");
+ return my_global;
+ // CHECK: MemorySanitizer: use-of-uninitialized-value
+ // CHECK: #0 {{.*}} in main{{.*}}dlopen_executable.cc:[[@LINE-2]]
+}
Index: compiler-rt/trunk/lib/msan/msan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc
@@ -1434,10 +1434,11 @@
} while (false) // FIXME
#define COMMON_INTERCEPTOR_BLOCK_REAL(name) REAL(name)
#define COMMON_INTERCEPTOR_ON_EXIT(ctx) OnExit()
-#define COMMON_INTERCEPTOR_LIBRARY_LOADED(filename, handle) \
- do { \
- link_map *map = GET_LINK_MAP_BY_DLOPEN_HANDLE((handle)); \
- if (map) ForEachMappedRegion(map, __msan_unpoison); \
+#define COMMON_INTERCEPTOR_LIBRARY_LOADED(filename, handle) \
+ do { \
+ link_map *map = GET_LINK_MAP_BY_DLOPEN_HANDLE((handle)); \
+ if (filename && map) \
+ ForEachMappedRegion(map, __msan_unpoison); \
} while (false)
#define COMMON_INTERCEPTOR_GET_TLS_RANGE(begin, end) \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14795.40580.patch
Type: text/x-patch
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151119/17bf4c58/attachment.bin>
More information about the llvm-commits
mailing list