From ae23852e41ca695e866832b4339905a172d0d913 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 27 Feb 2021 14:07:59 +0000 Subject: [PATCH] Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition. Closes GH-6738. --- ext/opcache/shared_alloc_mmap.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.50.1