[PATCH] D14929: [compiler-rt] [msan] Test fixes for msan with libc++
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 23 09:31:39 PST 2015
zatrazz created this revision.
zatrazz added reviewers: aemerson, rengolin, samsonov, eugenis, dvyukov.
zatrazz added a subscriber: llvm-commits.
Herald added a subscriber: aemerson.
This patch adds some fixes for MSAN with libc++ for aarch64:
1. Adds the libmsan_loadable name for aarch64.
2. Fixes some pthread_attr_setstacksize for aarch64, since glibc sets
the mininum stack size to be higher than the x86_64 default (16KB
vs 128KB).
3. Fixes a swprintf null char constant definition.
http://reviews.llvm.org/D14929
Files:
lib/msan/tests/msan_test.cc
Index: lib/msan/tests/msan_test.cc
===================================================================
--- lib/msan/tests/msan_test.cc
+++ lib/msan/tests/msan_test.cc
@@ -1883,7 +1883,7 @@
ASSERT_EQ(buff[1], '2');
ASSERT_EQ(buff[2], '3');
ASSERT_EQ(buff[6], '7');
- ASSERT_EQ(buff[7], 0);
+ ASSERT_EQ(buff[7], L'\0');
EXPECT_POISONED(buff[8]);
}
@@ -2886,6 +2886,8 @@
static const char basename[] = "libmsan_loadable.mips64.so";
#elif defined(__mips64)
static const char basename[] = "libmsan_loadable.mips64el.so";
+#elif defined(__aarch64__)
+ static const char basename[] = "libmsan_loadable.aarch64.so";
#endif
int res = snprintf(buf, sz, "%.*s/%s",
(int)dir_len, program_path, basename);
@@ -2992,14 +2994,22 @@
return 0;
}
+#ifdef PTHREAD_STACK_MIN
+# define SMALLSTACKSIZE PTHREAD_STACK_MIN
+# define SMALLPRESTACKSIZE PTHREAD_STACK_MIN
+#else
+# define SMALLSTACKSIZE 64 * 1024
+# define SMALLPRESTACKSIZE 16 * 1024
+#endif
+
TEST(MemorySanitizer, SmallStackThread) {
pthread_attr_t attr;
pthread_t t;
void *p;
int res;
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
- res = pthread_attr_setstacksize(&attr, 64 * 1024);
+ res = pthread_attr_setstacksize(&attr, SMALLSTACKSIZE);
ASSERT_EQ(0, res);
res = pthread_create(&t, &attr, SmallStackThread_threadfn, NULL);
ASSERT_EQ(0, res);
@@ -3016,7 +3026,7 @@
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
void *stack;
- const size_t kStackSize = 16 * 1024;
+ const size_t kStackSize = SMALLPRESTACKSIZE;
res = posix_memalign(&stack, 4096, kStackSize);
ASSERT_EQ(0, res);
res = pthread_attr_setstack(&attr, stack, kStackSize);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14929.40939.patch
Type: text/x-patch
Size: 1701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151123/d884cb86/attachment.bin>
More information about the llvm-commits
mailing list