Skip to content

Commit 6fb8b9d

Browse files
committed
Fix possible segfault with 0x0 shared opcache base
Moving the minimum base of the shared opcache memory to the second huge page to avoid a possible 0x0 base, which may cause all sorts of segfaults. This is not a problem on most systems which have a mmap_min_addr which is non-zero, but e.g. WSL1 doesn't have a minimum mapping address.
1 parent 0079932 commit 6fb8b9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/opcache/shared_alloc_mmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
static void *find_prefered_mmap_base(size_t requested_size)
5050
{
5151
size_t huge_page_size = 2 * 1024 * 1024;
52-
uintptr_t last_free_addr = 0;
52+
uintptr_t last_free_addr = huge_page_size;
5353
uintptr_t last_candidate = (uintptr_t)MAP_FAILED;
5454
uintptr_t start, end, text_start = 0;
5555
#if defined(__linux__)

0 commit comments

Comments
 (0)