From e502aaf0c596ff7cdfbd9ee1c21e050fb5f87e58 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 4 Dec 2023 13:29:47 +0300 Subject: [PATCH] Prevent starting JIT on x86_64 with buffuer size above 2G --- ext/opcache/jit/zend_jit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 098b7637e5030..3c62e25871b55 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -3414,6 +3414,13 @@ ZEND_EXT_API int zend_jit_check_support(void) JIT_G(on) = 0; return FAILURE; } +#elif defined(IR_TARGET_X64) + if (JIT_G(buffer_size) > 2 * Z_L(1024*1024*1024)) { + zend_error(E_WARNING, "JIT on x86_64 doesn't support opcache.jit_buffer_size above 2G."); + JIT_G(enabled) = 0; + JIT_G(on) = 0; + return FAILURE; + } #endif return SUCCESS;