Skip to content

Commit 07e5953

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: opcache: Call orig_post_shutdown_cb() JIT: Discard veneers if generation failed
2 parents 6c1559d + 37f495c commit 07e5953

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ PHP NEWS
138138
map_ptr offset). (prateekbhujel)
139139
. Fixed tracing JIT losing register-allocated CVs when an interrupt is
140140
handled at the end of a loop trace. (Levi Morrison)
141+
. Fixed bug GH-24675 (function with >~1.7 MB of machine code corrupts JIT
142+
buffer accounting). (ndossche)
143+
. Call orig_post_shutdown_cb(). (ndossche)
141144

142145
- PDO:
143146
. Fixed invalid ATTR_ORACLE_NULLS values being accepted and truncated.

‎ext/opcache/ZendAccelerator.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,6 +3500,11 @@ static void (*orig_post_shutdown_cb)(void);
35003500

35013501
static void accel_post_shutdown(void)
35023502
{
3503+
/* Call original shutdown prior to detaching SHM, so it can access its memory safely. */
3504+
if (orig_post_shutdown_cb) {
3505+
orig_post_shutdown_cb();
3506+
}
3507+
35033508
zend_shared_alloc_shutdown();
35043509
}
35053510

‎ext/opcache/jit/zend_jit_ir.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ static void zend_jit_commit_veneers(void)
472472
}
473473
}
474474
}
475+
476+
static void zend_jit_discard_veneers(void)
477+
{
478+
int i, count = sizeof(zend_jit_stubs) / sizeof(zend_jit_stubs[0]);
479+
480+
for (i = 0; i < count; i++) {
481+
zend_jit_stub_handlers[count + i] = NULL;
482+
}
483+
}
475484
#endif
476485

477486
static bool zend_jit_prefer_const_addr_load(zend_jit_ctx *jit, uintptr_t addr)
@@ -2967,7 +2976,11 @@ static void *zend_jit_ir_compile(ir_ctx *ctx, size_t *size, const char *name)
29672976

29682977
#if defined(IR_TARGET_AARCH64)
29692978
if (ctx->flags2 & IR_HAS_VENEERS) {
2970-
zend_jit_commit_veneers();
2979+
if (entry) {
2980+
zend_jit_commit_veneers();
2981+
} else {
2982+
zend_jit_discard_veneers();
2983+
}
29712984
}
29722985
#endif
29732986

0 commit comments

Comments
 (0)