[llvm-branch-commits] [compiler-rt-branch] r270399 - Merging r261837:

Mohit K. Bhakkad via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 23 00:06:57 PDT 2016


Author: mohit.bhakkad
Date: Mon May 23 02:03:45 2016
New Revision: 270399

URL: http://llvm.org/viewvc/llvm-project?rev=270399&view=rev
Log:
Merging r261837:
------------------------------------------------------------------------
r261837 | mohit.bhakkad | 2016-02-25 13:37:44 +0530 (Thu, 25 Feb 2016) | 7 lines

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

Reviewers: samsonov

Subscribers: jaydeep, sagar, llvm-commits

Differential Revision: http://reviews.llvm.org/D17262
------------------------------------------------------------------------

Modified:
    compiler-rt/branches/release_38/   (props changed)
    compiler-rt/branches/release_38/lib/msan/tests/msan_test.cc

Propchange: compiler-rt/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 02:03:45 2016
@@ -1 +1 @@
-/compiler-rt/trunk:258916,259755,260669,260839,260946,261073,261142,261148,261193,261263,261513,261721,261723
+/compiler-rt/trunk:258916,259755,260669,260839,260946,261073,261142,261148,261193,261263,261513,261721,261723,261837

Modified: compiler-rt/branches/release_38/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_38/lib/msan/tests/msan_test.cc?rev=270399&r1=270398&r2=270399&view=diff
==============================================================================
--- compiler-rt/branches/release_38/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/branches/release_38/lib/msan/tests/msan_test.cc Mon May 23 02:03:45 2016
@@ -1214,17 +1214,21 @@ TEST(MemorySanitizer, shmctl) {
 }
 
 TEST(MemorySanitizer, shmat) {
-  void *p = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
-                 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  ASSERT_NE(MAP_FAILED, p);
+  const int kShmSize = 4096;
+  void *mapping_start = mmap(NULL, kShmSize + SHMLBA, PROT_READ | PROT_WRITE,
+                             MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  ASSERT_NE(MAP_FAILED, mapping_start);
+
+  void *p = (void *)(((unsigned long)mapping_start + SHMLBA - 1) / SHMLBA * SHMLBA);
+  // p is now SHMLBA-aligned;
 
   ((char *)p)[10] = *GetPoisoned<U1>();
-  ((char *)p)[4095] = *GetPoisoned<U1>();
+  ((char *)p)[kShmSize - 1] = *GetPoisoned<U1>();
 
-  int res = munmap(p, 4096);
+  int res = munmap(mapping_start, kShmSize + SHMLBA);
   ASSERT_EQ(0, res);
 
-  int id = shmget(IPC_PRIVATE, 4096, 0644 | IPC_CREAT);
+  int id = shmget(IPC_PRIVATE, kShmSize, 0644 | IPC_CREAT);
   ASSERT_GT(id, -1);
 
   void *q = shmat(id, p, 0);
@@ -1232,7 +1236,7 @@ TEST(MemorySanitizer, shmat) {
 
   EXPECT_NOT_POISONED(((char *)q)[0]);
   EXPECT_NOT_POISONED(((char *)q)[10]);
-  EXPECT_NOT_POISONED(((char *)q)[4095]);
+  EXPECT_NOT_POISONED(((char *)q)[kShmSize - 1]);
 
   res = shmdt(q);
   ASSERT_EQ(0, res);




More information about the llvm-branch-commits mailing list