Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ sys/file.h \
sys/mman.h \
sys/mount.h \
sys/poll.h \
sys/procctl.h \
sys/resource.h \
sys/select.h \
sys/socket.h \
Expand Down Expand Up @@ -587,6 +588,7 @@ mmap \
nice \
nl_langinfo \
poll \
procctl \
putenv \
scandir \
setitimer \
Expand Down
10 changes: 10 additions & 0 deletions ext/opcache/shared_alloc_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#include <mach/vm_statistics.h>
#endif

#ifdef HAVE_SYS_PROCCTL_H
#include <sys/procctl.h>
#endif

#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
# define MAP_ANONYMOUS MAP_ANON
#endif
Expand All @@ -45,6 +49,12 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
zend_shared_segment *shared_segment;
int flags = PROT_READ | PROT_WRITE, fd = -1;
void *p;
#if defined(HAVE_PROCCTL) && defined(PROC_WXMAP_CTL)
int enable_wxmap = PROC_WX_MAPPINGS_PERMIT;
if (procctl(P_PID, getpid(), PROC_WXMAP_CTL, &enable_wxmap) == -1) {
return ALLOC_FAILURE;
}
#endif
#ifdef PROT_MPROTECT
flags |= PROT_MPROTECT(PROT_EXEC);
#endif
Expand Down