-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Assertion failure with tracing JIT #9011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've debugged this for a while and can only reproduce this on Windows. It seemed related to the handling of side exits with internal functions. php-src/ext/opcache/jit/zend_jit_ir.c Lines 9020 to 9026 in b06f2bc
The last part of the check looked suspicious to me. Why do we skip internal functions on Windows? I would expect the opposite: because of ASLR we do have to make a guard that checks if the function address is unchanged. Therefore, we must execute this code for internal functions as well on Windows to get the potential side exit. The reason this fixes the issue here is because in the trace we initially inferred the function to execute being Patch made on branch PHP-8.4. (On master, more places may need changes, I could do this if this is the right approach) diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index e4b68d23520..a1612948782 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -9006,9 +9006,6 @@ static int zend_jit_init_method_call(zend_jit_ctx *jit,
&& trace
&& trace->op == ZEND_JIT_TRACE_INIT_CALL
&& trace->func
-#ifdef _WIN32
- && trace->func->type != ZEND_INTERNAL_FUNCTION
-#endif
) {
int32_t exit_point;
const void *exit_addr;
I thought first, an alternative solution is maybe to check if the function type is still the same, but that would not be enough probably because of ASLR. I could be wrong. cc @dstogov |
@nielsdos thanks for analyses. The comparison of zend_internal_functions on Windows may be inaccurate because of ASLR. I may back-port the fix to PHP-8.2/8.3 later. |
* Backport fix for phpGH-9011 * Fix build
Description
The following code (script provided by @zeriyoshi):
Resulted in this output:
php-src/ext/opcache/jit/zend_jit_trace.c
Lines 7678 to 7679 in 789a37f
But I expected this output instead:
PHP Version
Operating System
Windows, maybe others as well
The text was updated successfully, but these errors were encountered: