summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-02-27 14:07:59 +0000
committerNikita Popov <nikita.ppv@gmail.com>2021-03-05 16:44:08 +0100
commitae23852e41ca695e866832b4339905a172d0d913 (patch)
treebd73059e3bc60054f638f1e8368f36c735f0577a
parent1c16749eaa760fc68769a831603eccb45ae11110 (diff)
downloadphp-git-ae23852e41ca695e866832b4339905a172d0d913.tar.gz
Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition.
Closes GH-6738.
-rw-r--r--ext/opcache/shared_alloc_mmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c
index 3d2884e948..c30a3b483c 100644
--- a/ext/opcache/shared_alloc_mmap.c
+++ b/ext/opcache/shared_alloc_mmap.c
@@ -44,6 +44,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
#ifdef PROT_MPROTECT
flags |= PROT_MPROTECT(PROT_EXEC);
#endif
+#ifdef PROT_MAX
+ flags |= PROT_MAX(PROT_READ | PROT_WRITE | PROT_EXEC);
+#endif
#ifdef MAP_HUGETLB
size_t huge_page_size = 2 * 1024 * 1024;