[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Arnaud Le Blanc | Date: | Fri, 04 Sep 2026 12:46:33 +0000 |
| Subject: | [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141064@lists.php.net to get a copy of this message | ||
Author: Arnaud Le Blanc (arnaud-lb)
Date: 2026-09-04T14:45:08+02:00
Commit: https://github.com/php/php-src/commit/f90dd1ce6f7f555ff95374cb146dc7bd4230e78c
Raw diff: https://github.com/php/php-src/commit/f90dd1ce6f7f555ff95374cb146dc7bd4230e78c.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/opcache: keep huge page remap inside the reserved range (#23554)
Changed paths:
M NEWS
M ext/opcache/shared_alloc_mmap.c
Diff:
diff --git a/NEWS b/NEWS
index 82adcae4408b..6ca8aa09a4cd 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,8 @@ PHP NEWS
. Fixed a tracing JIT crash when compiling a side trace for a method of a
class that could not be stored in the inheritance cache. (GH-21710)
(Arnaud, iliaal)
+ . Fixed a crash when the huge page SHM remap discarded mappings outside the
+ reserved address range. (Piotr Hałas)
- PDO:
. Fixed a leak when a persistent connection failed a liveness check
diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c
index cf5dbb29ebfd..46e510d7767e 100644
--- a/ext/opcache/shared_alloc_mmap.c
+++ b/ext/opcache/shared_alloc_mmap.c
@@ -245,9 +245,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
/* to got HUGE PAGES in low 32-bit address we have to reserve address
space and then remap it using MAP_HUGETLB */
- p = mmap(NULL, requested_size, flags, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, fd, 0);
+ p = mmap(NULL, requested_size + huge_page_size, flags, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, fd,
0);
if (p != MAP_FAILED) {
- munmap(p, requested_size);
+ munmap(p, requested_size + huge_page_size);
p = (void*)(ZEND_MM_ALIGNED_SIZE_EX((ptrdiff_t)p, huge_page_size));
p = mmap(p, requested_size, flags, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT|MAP_HUGETLB|MAP_FIXED, -1,
0);
if (p != MAP_FAILED) {