From 463aa75635564f02e628ae18af9f561380dd4fd6 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 12 May 2015 21:52:08 +0000 Subject: [PATCH] In functions VG_(am_relocate_nooverlap_client) and VG_(am_extend_map_client) need to allow SkShmC segments, too. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15221 --- coregrind/m_aspacemgr/aspacemgr-linux.c | 6 ++++-- none/tests/linux/Makefile.am | 2 ++ none/tests/linux/mremap5.c | 23 +++++++++++++++++++++++ none/tests/linux/mremap5.stderr.exp | 0 none/tests/linux/mremap5.vgtest | 2 ++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 none/tests/linux/mremap5.c create mode 100644 none/tests/linux/mremap5.stderr.exp create mode 100644 none/tests/linux/mremap5.vgtest diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index e77d1da0c5..4be99fa122 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -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) diff --git a/none/tests/linux/Makefile.am b/none/tests/linux/Makefile.am index 46e248628a..125d1203a2 100644 --- a/none/tests/linux/Makefile.am +++ b/none/tests/linux/Makefile.am @@ -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 index 0000000000..dcea248d78 --- /dev/null +++ b/none/tests/linux/mremap5.c @@ -0,0 +1,23 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +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 index 0000000000..e69de29bb2 diff --git a/none/tests/linux/mremap5.vgtest b/none/tests/linux/mremap5.vgtest new file mode 100644 index 0000000000..57f161a0fc --- /dev/null +++ b/none/tests/linux/mremap5.vgtest @@ -0,0 +1,2 @@ +prog: mremap5 +vgopts: -q -- 2.47.3