Skip to content

Commit 71e1fad

Browse files
authored
Merge pull request #6855 from hkuno/hkuno/mmap_loop
Fix mmap infinite recurse in memory patcher
2 parents 5a3646f + fca8436 commit 71e1fad

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

opal/mca/memory/patcher/configure.m4

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ AC_DEFUN([MCA_opal_memory_patcher_CONFIG],[
4747
esac
4848
AC_MSG_RESULT([$opal_memory_patcher_happy])
4949

50+
# syscall interface causes compiler warnings.
51+
# Per the above logic, memory patcher no longer supports MacOS/Darwin,
52+
# so we no longer support Darwin-specific logic for intercept_mmap.
53+
# See issue #6853: mmap infinite recurse in opal/mca/memory/patcher
5054
AS_IF([test "$opal_memory_patcher_happy" == "yes"], [
5155
AC_CHECK_FUNCS([__curbrk])
52-
AC_CHECK_HEADERS([linux/mman.h sys/syscall.h])
53-
AC_CHECK_DECLS([__mmap], [], [], [#include <sys/mman.h>])
54-
AC_CHECK_FUNCS([__mmap])
55-
AC_CHECK_DECLS([__syscall], [], [], [#include <sys/syscall.h>])
56-
AC_CHECK_FUNCS([__syscall])
56+
AC_CHECK_HEADERS([linux/mman.h sys/syscall.h])
57+
AC_CHECK_DECLS([__syscall], [], [], [#include <sys/syscall.h>])
58+
AC_CHECK_FUNCS([__syscall])
5759
$1], [$2])
5860

5961
AC_CONFIG_FILES([opal/mca/memory/patcher/Makefile])

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,7 @@ static void *_intercept_mmap(void *start, size_t length, int prot, int flags, in
125125
}
126126

127127
if (!original_mmap) {
128-
#ifdef HAVE___MMAP
129-
/* the darwin syscall returns an int not a long so call the underlying __mmap function */
130-
result = __mmap (start, length, prot, flags, fd, offset);
131-
#else
132128
result = (void*)(intptr_t) memory_patcher_syscall(SYS_mmap, start, length, prot, flags, fd, offset);
133-
#endif
134129
} else {
135130
result = original_mmap (start, length, prot, flags, fd, offset);
136131
}

0 commit comments

Comments
 (0)