summaryrefslogtreecommitdiffstats
path: root/php-upstream.patch
blob: 0a11cbe36b648f34d2c94228fad5639069bee9c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 8cc7e2a2df912d86f6b9dc3f3d40e5de1d93214b Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Wed, 29 Aug 2018 14:40:59 +0200
Subject: [PATCH] Revert "Don't report mmap failure if it is expected"

This reverts commit 446b5b15d324dacd30f58313563a9d625fb54ac8.
---
 Zend/zend_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index d81616a87a4b..8eec54c6f703 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -432,7 +432,7 @@ static void *zend_mm_mmap_fixed(void *addr, size_t size)
 	void *ptr = mmap(addr, size, PROT_READ | PROT_WRITE, flags /*| MAP_POPULATE | MAP_HUGETLB*/, -1, 0);
 
 	if (ptr == MAP_FAILED) {
-#if ZEND_MM_ERROR && !defined(MAP_FIXED_NOREPLACE) && !defined(MAP_EXCL)
+#if ZEND_MM_ERROR
 		fprintf(stderr, "\nmmap() failed: [%d] %s\n", errno, strerror(errno));
 #endif
 		return NULL;
From a55bcaa14ddba2df0c0f9c7f4444fc9d9f6564fd Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Wed, 29 Aug 2018 14:41:04 +0200
Subject: [PATCH] Revert "Support fixed address mmap without replacement"

This reverts commit 0f68ff5c92924deb9401ce66458e67f250ccde74.
---
 Zend/zend_alloc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 8eec54c6f703..11691d837759 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -423,13 +423,8 @@ static void *zend_mm_mmap_fixed(void *addr, size_t size)
 #ifdef _WIN32
 	return VirtualAlloc(addr, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
 #else
-	int flags = MAP_PRIVATE | MAP_ANON;
-#ifdef MAP_FIXED_NOREPLACE
-	flags |= MAP_FIXED_NOREPLACE;
-#elif defined MAP_EXCL
-	flags |= MAP_FIXED | MAP_EXCL;
-#endif
-	void *ptr = mmap(addr, size, PROT_READ | PROT_WRITE, flags /*| MAP_POPULATE | MAP_HUGETLB*/, -1, 0);
+	/* MAP_FIXED leads to discarding of the old mapping, so it can't be used. */
+	void *ptr = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON /*| MAP_POPULATE | MAP_HUGETLB*/, -1, 0);
 
 	if (ptr == MAP_FAILED) {
 #if ZEND_MM_ERROR