57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
--- ./opal/mca/memory/patcher/memory_patcher_component.c.orig 2020-06-10 21:35:37.000000000 +0000
|
|
+++ ./opal/mca/memory/patcher/memory_patcher_component.c 2020-07-04 10:42:40.459784443 +0000
|
|
@@ -250,9 +250,9 @@
|
|
advice == MADV_FREE ||
|
|
#endif
|
|
#ifdef MADV_REMOVE
|
|
- advice == MADV_REMOVE ||
|
|
+ advice == MADV_REMOVE
|
|
#endif
|
|
- advice == POSIX_MADV_DONTNEED)
|
|
+ )
|
|
{
|
|
opal_mem_hooks_release_hook (start, length, false);
|
|
}
|
|
@@ -346,10 +346,17 @@
|
|
#define IPCOP_shmdt 22
|
|
#endif
|
|
|
|
-#define HAS_SHMDT (defined(SYS_shmdt) || \
|
|
- (defined(IPCOP_shmdt) && defined(SYS_ipc)))
|
|
-#define HAS_SHMAT (defined(SYS_shmat) || \
|
|
- (defined(IPCOP_shmat) && defined(SYS_ipc)))
|
|
+#if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc))
|
|
+# define HAS_SHMDT 1
|
|
+# else
|
|
+# define HAS_SHMDT 0
|
|
+#endif
|
|
+
|
|
+#if defined(SYS_shmat) || (defined(IPCOP_shmat) && defined(SYS_ipc))
|
|
+# define HAS_SHMAT 1
|
|
+# else
|
|
+# define HAS_SHMAT 0
|
|
+#endif
|
|
|
|
#if (HAS_SHMDT || HAS_SHMAT) && defined(__linux__)
|
|
|
|
@@ -444,8 +447,8 @@
|
|
uintptr_t attach_addr = (uintptr_t)shmaddr;
|
|
|
|
if (shmflg & SHM_RND) {
|
|
- attach_addr -= ((uintptr_t)shmaddr) % SHMLBA;
|
|
- size += ((uintptr_t)shmaddr) % SHMLBA;
|
|
+ attach_addr -= ((uintptr_t)shmaddr) % sysconf(_SC_PAGESIZE);
|
|
+ size += ((uintptr_t)shmaddr) % sysconf(_SC_PAGESIZE);
|
|
}
|
|
opal_mem_hooks_release_hook ((void*)attach_addr, size, false);
|
|
}
|
|
@@ -457,7 +460,7 @@
|
|
unsigned long ret;
|
|
ret = memory_patcher_syscall(SYS_ipc, IPCOP_shmat,
|
|
shmid, shmflg, &shmaddr, shmaddr);
|
|
- result = (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)shmaddr;
|
|
+ result = (ret > -(unsigned long)sysconf(_SC_PAGESIZE)) ? (void *)ret : (void *)shmaddr;
|
|
#endif
|
|
} else {
|
|
result = original_shmat (shmid, shmaddr, shmflg);
|