1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fixed GH-12596: Segmentation fault on AArch64 release build with opcache.jit=1112 (#12813)

This commit is contained in:
Dmitry Stogov
2023-12-05 12:04:00 +03:00
committed by GitHub
parent 8d98f7202a
commit 8cc6b3576e
3 changed files with 20 additions and 22 deletions

21
Zend/zend_vm_execute.h generated
View File

@@ -345,7 +345,16 @@ static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op
# define VM_TRACE_END()
#endif
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
#define HYBRID_NEXT() goto *(void**)(OPLINE->handler)
# if defined(__GNUC__) && defined(__i386__)
# define HYBRID_JIT_GUARD() __asm__ __volatile__ (""::: "ebx")
# elif defined(__GNUC__) && defined(__x86_64__)
# define HYBRID_JIT_GUARD() __asm__ __volatile__ (""::: "rbx","r12","r13")
# elif defined(__GNUC__) && defined(__aarch64__)
# define HYBRID_JIT_GUARD() __asm__ __volatile__ (""::: "x19","x20","x21","x22","x23","x24","x25","x26")
# else
# define HYBRID_JIT_GUARD()
# endif
#define HYBRID_NEXT() HYBRID_JIT_GUARD(); goto *(void**)(OPLINE->handler)
#define HYBRID_SWITCH() HYBRID_NEXT();
#define HYBRID_CASE(op) op ## _LABEL
#define HYBRID_BREAK() HYBRID_NEXT()
@@ -56980,16 +56989,6 @@ ZEND_API void execute_ex(zend_execute_data *ex)
}
#endif
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
/* Force C compiler to store preserved registers to allow JIT using them */
# if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__ (""::: "ebx");
# elif defined(__GNUC__) && defined(__x86_64__)
__asm__ __volatile__ (""::: "rbx","r12","r13");
# elif defined(__GNUC__) && defined(__aarch64__)
__asm__ __volatile__ (""::: "x19","x20","x21","x22","x23","x24","x25","x26");
# endif
#endif
LOAD_OPLINE();
ZEND_VM_LOOP_INTERRUPT_CHECK();

View File

@@ -13,16 +13,6 @@ ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *ex)
{%INTERNAL_LABELS%}
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
/* Force C compiler to store preserved registers to allow JIT using them */
# if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__ (""::: "ebx");
# elif defined(__GNUC__) && defined(__x86_64__)
__asm__ __volatile__ (""::: "rbx","r12","r13");
# elif defined(__GNUC__) && defined(__aarch64__)
__asm__ __volatile__ (""::: "x19","x20","x21","x22","x23","x24","x25","x26");
# endif
#endif
LOAD_OPLINE();
ZEND_VM_LOOP_INTERRUPT_CHECK();

View File

@@ -1844,7 +1844,16 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
switch ($kind) {
case ZEND_VM_KIND_HYBRID:
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
out($f,"#define HYBRID_NEXT() goto *(void**)(OPLINE->handler)\n");
out($f,"# if defined(__GNUC__) && defined(__i386__)\n");
out($f,"# define HYBRID_JIT_GUARD() __asm__ __volatile__ (\"\"::: \"ebx\")\n");
out($f,"# elif defined(__GNUC__) && defined(__x86_64__)\n");
out($f,"# define HYBRID_JIT_GUARD() __asm__ __volatile__ (\"\"::: \"rbx\",\"r12\",\"r13\")\n");
out($f,"# elif defined(__GNUC__) && defined(__aarch64__)\n");
out($f,"# define HYBRID_JIT_GUARD() __asm__ __volatile__ (\"\"::: \"x19\",\"x20\",\"x21\",\"x22\",\"x23\",\"x24\",\"x25\",\"x26\")\n");
out($f,"# else\n");
out($f,"# define HYBRID_JIT_GUARD()\n");
out($f,"# endif\n");
out($f,"#define HYBRID_NEXT() HYBRID_JIT_GUARD(); goto *(void**)(OPLINE->handler)\n");
out($f,"#define HYBRID_SWITCH() HYBRID_NEXT();\n");
out($f,"#define HYBRID_CASE(op) op ## _LABEL\n");
out($f,"#define HYBRID_BREAK() HYBRID_NEXT()\n");