[php-src] PR #14841: Resolve Inconsistency in zend_jit_return Between JIT and Non-JIT Engines
| From: | segrax | Date: | Sat, 06 Jul 2024 07:02:35 +0000 |
| Subject: | [php-src] PR #14841: Resolve Inconsistency in zend_jit_return Between JIT and Non-JIT Engines | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-27074@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14841
Author: segrax
This resolves an inconsistency in both the x86 and ARM64 implementation of
zend_jit_return between the JIT and non-JIT engines (op:
**ZEND_RETURN_SPEC_OBSERVER**).
### Issue
- Non-JIT Engine: zend_observer_fcall_end is invoked after the returned
zval is copied into execute_data->return_value.
- JIT Engine: zend_observer_fcall_end is invoked before the returned zval
is copied.
### Behaviour
Extensions using the value in execute_data->return_value behave differently in JIT
mode, which can lead to incorrect readings, and/or segfaults if values are being modified.
### Affects
PHP 8.1 to 8.4 ([issue is present in the new
JIT](https://github.com/php/php-src/blob/e4904a21996cfee9c876122ec5bf3802144f4fd0/ext/opcache/jit/zend_jit_ir.c#L10897))
### Tests
I've extended the zend_test extension to allow hooks to be executed from calls to
zend_observer_fcall_end, and added a test which modifies the return value