From eb59dd7d8137c6567afcd579bcb3bd0298f5bbc4 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Thu, 29 Oct 2015 08:44:19 +0300 Subject: [PATCH] Don't remap .text segment if huge pages are not available. --- ext/opcache/ZendAccelerator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 14dce59f31..eaadac6e3a 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2529,7 +2529,10 @@ static int accel_remap_huge_pages(void *start, size_t size, const char *name, si PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); - madvise(start, size, MADV_HUGEPAGE); + if (-1 == madvise(start, size, MADV_HUGEPAGE)) { + munmap(mem, size); + return -1; + } } # endif if (ret == start) { -- 2.40.0