From d7db5f4c3217e9e068be0c4737fdf4e888ba54ee Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 7 Oct 2009 12:39:01 +0000 Subject: [PATCH] mmap(2) says that you must call mmap() with either MAP_SHARED or MAP_PRIVATE. We didn't catch this because we checked for a NULL return, not a -1 return. Doh! Thanks again to Julian Seward for continuing to track this down. This commit was SVN r22062. --- opal/mca/memory/ptmalloc2/opal_ptmalloc2_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/memory/ptmalloc2/opal_ptmalloc2_component.c b/opal/mca/memory/ptmalloc2/opal_ptmalloc2_component.c index 8214c20bd8..7c74064f8d 100644 --- a/opal/mca/memory/ptmalloc2/opal_ptmalloc2_component.c +++ b/opal/mca/memory/ptmalloc2/opal_ptmalloc2_component.c @@ -133,8 +133,8 @@ static int ptmalloc2_open(void) val |= OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_CHUNK_SUPPORT; } - p = mmap(NULL, 4096, PROT_READ, MAP_ANONYMOUS, -1, 0); - if (NULL == p) { + p = mmap(NULL, 4096, PROT_READ, (MAP_ANONYMOUS | MAP_PRIVATE), -1, 0); + if (((void*) -1) == p) { return OPAL_ERR_OUT_OF_RESOURCE; } munmap(p, 4096);