From 2782577c4f61cbfa7273c0b2ba656ebdee9ed9a7 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 31 Oct 2023 21:42:25 +0300 Subject: [PATCH] Prevent starting JIT on AArch64 with buffuer aize above 128M B and BL instructions are limited by 128M offset --- ext/opcache/jit/zend_jit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 5b45dca51a9..2380e49f3b8 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -3369,6 +3369,15 @@ ZEND_EXT_API int zend_jit_check_support(void) } } +#if defined(IR_TARGET_AARCH64) + if (JIT_G(buffer_size) > 128*1024*1024) { + zend_error(E_WARNING, "JIT on AArch64 doesn't support opcache.jit_buffer_size above 128M."); + JIT_G(enabled) = 0; + JIT_G(on) = 0; + return FAILURE; + } +#endif + return SUCCESS; }