[php-src] PHP-8.2: Fix exception IP in JIT (#13929)
| From: | Bob Weinand via GitHub | Date: | Wed, 10 Apr 2024 18:38:00 +0000 |
| Subject: | [php-src] PHP-8.2: Fix exception IP in JIT (#13929) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-128061@lists.php.net to get a copy of this message | ||
Author: Bob Weinand (bwoebi)
Committer: GitHub (web-flow)
Pusher: bwoebi
Date: 2024-04-10T20:37:54+02:00
Commit: https://github.com/php/php-src/commit/ea927caffa52c249e4976110be1d147c2d035e2c
Raw diff: https://github.com/php/php-src/commit/ea927caffa52c249e4976110be1d147c2d035e2c.diff
Fix exception IP in JIT (#13929)
Changed paths:
M ext/opcache/jit/zend_jit_arm64.dasc
M ext/opcache/jit/zend_jit_x86.dasc
Diff:
diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc
index 37fca7cfeb60..910105aa5bbf 100644
--- a/ext/opcache/jit/zend_jit_arm64.dasc
+++ b/ext/opcache/jit/zend_jit_arm64.dasc
@@ -688,7 +688,7 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size)
| .if ZTS
|| if (GCC_GLOBAL_REGS) {
| LOAD_TSRM_CACHE IP
-| MEM_ACCESS_64_WITH_UOFFSET ldr, IP, IP, (struct.._offset+offsetof(zend_..struct, field)),
tmp_reg
+| ADD_SUB_64_WITH_CONST_32 add, IP, IP, (struct.._offset+offsetof(zend_..struct, field)),
tmp_reg
|| } else {
| LOAD_TSRM_CACHE RX
| ADD_SUB_64_WITH_CONST_32 add, RX, RX, (struct.._offset+offsetof(zend_..struct, field)), tmp_reg
@@ -1935,6 +1935,7 @@ static int zend_jit_leave_throw_stub(dasm_State **Dst)
|5:
| // opline = EG(exception_op);
| LOAD_IP_ADDR_ZTS executor_globals, exception_op, TMP2
+ | str IP, EX->opline
| // HANDLE_EXCEPTION()
| b ->exception_handler
} else {
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 7ae69c9fb657..d083bf47c76d 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -406,7 +406,7 @@ static size_t tsrm_tls_offset;
| .if ZTS
|| if (GCC_GLOBAL_REGS) {
| LOAD_TSRM_CACHE IP
-| mov IP, aword [IP + (struct.._offset + offsetof(zend_..struct, field))]
+| lea IP, aword [IP + (struct.._offset + offsetof(zend_..struct, field))]
|| } else {
| LOAD_TSRM_CACHE RX
| lea RX, aword [RX + (struct.._offset + offsetof(zend_..struct, field))]
@@ -1884,6 +1884,7 @@ static int zend_jit_leave_throw_stub(dasm_State **Dst)
|5:
| // opline = EG(exception_op);
| LOAD_IP_ADDR_ZTS executor_globals, exception_op
+ | mov aword EX->opline, IP
| // HANDLE_EXCEPTION()
| jmp ->exception_handler
} else {