From b6660634b4ff951d1ca98d02381853645faa57af Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Thu, 15 Feb 2024 10:24:41 +0100 Subject: [PATCH] Disable JIT on Apple Silicon + ZTS Apple Silicon has stricter rules about rwx mmap regions. They need to be created using the MAP_JIT flag. However, the MAP_JIT seems to be incompatible with MAP_SHARED. ZTS requires MAP_SHARED so that some threads may execute code from a page while another writes/appends to it. We did not find another solution, other than completely disabling JIT for Apple Silicon + ZTS. See discussion in https://github.com/php/php-src/pull/13351. Co-authored-by: Peter Kokot Fixes GH-13400 Closes GH-13396 --- ext/opcache/config.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 0b923206282..d35efbc689e 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -36,6 +36,10 @@ if test "$PHP_OPCACHE" != "no"; then PHP_OPCACHE_JIT=no ;; esac + if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then + AC_MSG_WARN([JIT not supported on Apple Silicon with ZTS]) + PHP_OPCACHE_JIT=no + fi fi if test "$PHP_OPCACHE_JIT" = "yes"; then