Skip to content

Commit 5390989

Browse files
committed
Fix asan shadow memory and shared_alloc_mmap clash
The memory region found by find_prefered_mmap_base may clash with memory regions reserved by asan for tracking memory. The symptom of this is that mprotect for JIT fails adding the PROT_EXEC flag to the shared memory region. Closes GH-12890
1 parent 299c3ba commit 5390989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/opcache/shared_alloc_mmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# define MAP_HUGETLB MAP_ALIGNED_SUPER
4646
#endif
4747

48-
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__))
48+
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
4949
static void *find_prefered_mmap_base(size_t requested_size)
5050
{
5151
size_t huge_page_size = 2 * 1024 * 1024;
@@ -169,7 +169,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
169169
#ifdef MAP_JIT
170170
flags |= MAP_JIT;
171171
#endif
172-
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__))
172+
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
173173
void *hint = find_prefered_mmap_base(requested_size);
174174
if (hint != MAP_FAILED) {
175175
# ifdef MAP_HUGETLB

0 commit comments

Comments
 (0)