]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
In functions VG_(am_relocate_nooverlap_client) and VG_(am_extend_map_client)
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 12 May 2015 21:52:08 +0000 (21:52 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 12 May 2015 21:52:08 +0000 (21:52 +0000)
need to allow SkShmC segments, too.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15221

coregrind/m_aspacemgr/aspacemgr-linux.c
none/tests/linux/Makefile.am
none/tests/linux/mremap5.c [new file with mode: 0644]
none/tests/linux/mremap5.stderr.exp [new file with mode: 0644]
none/tests/linux/mremap5.vgtest [new file with mode: 0644]

index e77d1da0c5ef5b583dea74a77281996d56c87968..4be99fa122dc75512b3fe5a2488d8e4530cb8f86 100644 (file)
@@ -2901,7 +2901,8 @@ const NSegment *VG_(am_extend_map_client)( Addr addr, SizeT delta )
 
    NSegment *seg = nsegments + ix;
 
-   aspacem_assert(seg->kind == SkFileC || seg->kind == SkAnonC);
+   aspacem_assert(seg->kind == SkFileC || seg->kind == SkAnonC ||
+                  seg->kind == SkShmC);
    aspacem_assert(delta > 0 && VG_IS_PAGE_ALIGNED(delta)) ;
 
    xStart = seg->end+1;
@@ -2979,7 +2980,8 @@ Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard,
    if (iLo != iHi)
       return False;
 
-   if (nsegments[iLo].kind != SkFileC && nsegments[iLo].kind != SkAnonC)
+   if (nsegments[iLo].kind != SkFileC && nsegments[iLo].kind != SkAnonC &&
+       nsegments[iLo].kind != SkShmC)
       return False;
 
    sres = ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY)
index 46e248628abf7dc8712f672c13c1ca1bbb5b2b5a..125d1203a2c362186eff0037b62fbff1a198a2c6 100644 (file)
@@ -12,6 +12,7 @@ EXTRA_DIST = \
        mremap2.stderr.exp mremap2.stdout.exp mremap2.vgtest \
        mremap3.stderr.exp mremap3.stdout.exp mremap3.vgtest \
        mremap4.stderr.exp mremap4.vgtest \
+       mremap5.stderr.exp mremap5.vgtest \
        pthread-stack.stderr.exp pthread-stack.vgtest \
        stack-overflow.stderr.exp stack-overflow.vgtest
 
@@ -23,6 +24,7 @@ check_PROGRAMS = \
        mremap2 \
        mremap3 \
        mremap4 \
+       mremap5 \
        pthread-stack \
        stack-overflow
 
diff --git a/none/tests/linux/mremap5.c b/none/tests/linux/mremap5.c
new file mode 100644 (file)
index 0000000..dcea248
--- /dev/null
@@ -0,0 +1,23 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+int main()
+{
+  int shmid = shmget(IPC_PRIVATE, 100 * 4096, 
+                     IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);
+  assert(shmid != -1);
+
+  void *addr = shmat(shmid, NULL, 0);
+  assert(addr != (void *)-1);
+
+  addr = mremap(addr, 100 * 4096, 400 * 4096, MREMAP_MAYMOVE);
+  assert(addr != (void *)-1);
+
+  return 0;
+}
diff --git a/none/tests/linux/mremap5.stderr.exp b/none/tests/linux/mremap5.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/none/tests/linux/mremap5.vgtest b/none/tests/linux/mremap5.vgtest
new file mode 100644 (file)
index 0000000..57f161a
--- /dev/null
@@ -0,0 +1,2 @@
+prog: mremap5
+vgopts: -q