Skip to content

Commit d0b4ed3

Browse files
committed
memory/patcher: do not hook mmap
Signed-off-by: Nathan Hjelm <[email protected]>
1 parent ab03460 commit d0b4ed3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ opal_memory_patcher_component_t mca_memory_patcher_component = {
8383
it out) */
8484
};
8585

86+
#if 0
87+
8688
#if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO
8789
/* prototype for Apple's internal mmap function */
8890
void *__mmap (void *start, size_t length, int prot, int flags, int fd, off_t offset);
@@ -127,6 +129,8 @@ static void *intercept_mmap(void *start, size_t length, int prot, int flags, int
127129
return result;
128130
}
129131

132+
#endif
133+
130134
static int (*original_munmap) (void *, size_t);
131135

132136
static int intercept_munmap(void *start, size_t length)
@@ -372,10 +376,14 @@ static int patcher_open (void)
372376
/* set memory hooks support level */
373377
opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT);
374378

379+
#if 0
380+
/* NTH: the only reason to hook mmap would be to detect memory protection. this does not invalidate
381+
* any cache entries in the region. */
375382
rc = opal_patcher->patch_symbol ("mmap", (uintptr_t) intercept_mmap, (uintptr_t *) &original_mmap);
376383
if (OPAL_SUCCESS != rc) {
377384
return rc;
378385
}
386+
#endif
379387

380388
rc = opal_patcher->patch_symbol ("munmap", (uintptr_t)intercept_munmap, (uintptr_t *) &original_munmap);
381389
if (OPAL_SUCCESS != rc) {

0 commit comments

Comments
 (0)