[PATCH] D17262: [Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 09:44:12 PST 2016


samsonov added inline comments.

================
Comment at: lib/msan/tests/msan_test.cc:1223
@@ +1222,3 @@
+  if ((unsigned long)p % SHMLBA != 0) {
+    *(unsigned long*)&p = ((unsigned long)p + SHMLBA - 1) / SHMLBA * SHMLBA;
+  }
----------------
Better cast the right-hand side to `void*`

================
Comment at: lib/msan/tests/msan_test.cc:1228
@@ -1221,3 +1227,3 @@
   ((char *)p)[10] = *GetPoisoned<U1>();
   ((char *)p)[4095] = *GetPoisoned<U1>();
 
----------------
s/4095/kShmSize - 1

================
Comment at: lib/msan/tests/msan_test.cc:1230
@@ -1223,3 +1229,3 @@
 
-  int res = munmap(p, 4096);
+  int res = munmap(p, kShmSize);
   ASSERT_EQ(0, res);
----------------
Hm? Shouldn't you unmap the original mmaped region of size kShmSize + SHMLBA?

================
Comment at: lib/msan/tests/msan_test.cc:1241
@@ -1234,3 +1240,3 @@
   EXPECT_NOT_POISONED(((char *)q)[10]);
   EXPECT_NOT_POISONED(((char *)q)[4095]);
 
----------------
kShmSize - 1?


Repository:
  rL LLVM

http://reviews.llvm.org/D17262





More information about the llvm-commits mailing list