@@ -1633,6 +1633,12 @@ static size_t tsrm_tls_offset;
16331633||#endif
16341634|.endmacro
16351635
1636+ #if defined (__CET__) && (__CET__ & 1) != 0
1637+ # define ENDBR_PADDING 4
1638+ #else
1639+ # define ENDBR_PADDING 0
1640+ #endif
1641+
16361642static bool reuse_ip = 0;
16371643static bool delayed_call_chain = 0;
16381644static uint32_t delayed_call_level = 0;
@@ -2302,6 +2308,7 @@ static int zend_jit_hybrid_hot_code_stub(dasm_State **Dst)
23022308 */
23032309static int zend_jit_hybrid_hot_counter_stub(dasm_State **Dst, uint32_t cost)
23042310{
2311+ | ENDBR
23052312 | mov r0, EX->func
23062313 | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
23072314 | mov r2, aword [r1 + offsetof(zend_jit_op_array_hot_extension, counter)]
@@ -2372,6 +2379,7 @@ static int zend_jit_hybrid_hot_trace_stub(dasm_State **Dst)
23722379
23732380static int zend_jit_hybrid_trace_counter_stub(dasm_State **Dst, uint32_t cost)
23742381{
2382+ | ENDBR
23752383 | mov r0, EX->func
23762384 | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
23772385 | mov r1, aword [r1 + offsetof(zend_jit_op_array_trace_extension, offset)]
@@ -3059,6 +3067,7 @@ static int zend_jit_align_func(dasm_State **Dst)
30593067
30603068static int zend_jit_prologue(dasm_State **Dst)
30613069{
3070+ | ENDBR
30623071 if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
30633072 | SUB_HYBRID_SPAD
30643073 } else if (GCC_GLOBAL_REGS) {
@@ -3466,7 +3475,7 @@ static int zend_jit_trace_link_to_root(dasm_State **Dst, zend_jit_trace_info *t,
34663475 prologue_size = 13;
34673476#endif
34683477 }
3469- link_addr = (const void*)((const char*)t->code_start + prologue_size);
3478+ link_addr = (const void*)((const char*)t->code_start + prologue_size + ENDBR_PADDING );
34703479
34713480 if (timeout_exit_addr) {
34723481 /* Check timeout for links to LOOP */
0 commit comments