Dmitry Stogov
42eed7bb4e
Fix GH-10271: Incorrect arithmetic calculations when using JIT
2023-01-16 14:51:26 +03:00
Max Kellermann
bcc5d268f6
ext/opcache/jit/zend_jit_trace: fix memory leak in _compile_root_trace() ( #10146 )
...
A copy of this piece of code exists in zend_jit_compile_side_trace(),
but there, the leak bug does not exist.
This bug exists since both copies of this piece of code were added in
commit 4bf2d09ede
2023-01-09 09:50:30 +03:00
Max Kellermann
e217138b40
ext/opcache/jit/zend_jit_trace: add missing lock for EXIT_INVALIDATE
...
Commit 6c25413183 added the flag ZEND_JIT_EXIT_INVALIDATE which
resets the trace handlers in zend_jit_trace_exit(), but forgot to
lock the shared memory section.
This could cause another worker process who still saw the
ZEND_JIT_TRACE_JITED flag to schedule ZEND_JIT_TRACE_STOP_LINK, but
when it arrived at the ZEND_JIT_DEBUG_TRACE_STOP, the handler was
already reverted by the first worker process and thus
zend_jit_find_trace() fails.
This in turn generated a bogus jump offset in the JITed code, crashing
the PHP process.
2022-12-29 12:20:56 +00:00
Max Kellermann
b26b758952
ext/opcache/jit: handle zend_jit_find_trace() failures
...
Commit 6c25413 added the flag ZEND_JIT_EXIT_INVALIDATE which resets
the trace handlers in zend_jit_trace_exit(), but forgot to consider
that on ZEND_JIT_TRACE_STOP_LINK, this changed handler gets passed to
zend_jit_find_trace(), causing it to fail, either by returning 0
(results in bogus data) or by aborting due to ZEND_UNREACHABLE(). In
either case, this crashes the PHP process.
I'm not quite sure how to fix this multi-threading problem properly;
my suggestion is to just fail the zend_jit_trace() call. After all,
the whole ZEND_JIT_EXIT_INVALIDATE fix was about reloading modified
scripts, so there's probably no point in this pending zend_jit_trace()
call.
2022-12-26 21:17:19 +00:00
Max Kellermann
d3a6eedf4a
ext/opcache/jit/zend_jit: fix inverted bailout value in zend_runtime_jit() ( #10144 )
...
In the "catch" block, do_bailout must be set to true, not false, or
else zend_bailout() never gets called.
2022-12-21 14:53:21 +01:00
Dmitry Stogov
a8bd342397
Fix memory leak
...
Fizes oss-fuzz #53143
2022-11-14 12:35:09 +03:00
Kévin Dunglas
af75eaf9bf
opcache: fix syntax error introduced in 261a08af65 ( #9821 )
2022-10-24 20:42:55 +03:00
Dmitry Stogov
261a08af65
JIT: Fix incorrect EX(opline) override
...
Fixes oss-fuzz #52674
2022-10-24 12:02:28 +03:00
Dmitry Stogov
61e563ca40
Reset JIT for dynamic functions on opcache restrart
2022-10-17 11:26:30 +03:00
Dmitry Stogov
3e076ddf06
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Discard disasm symbols on opcache restart
2022-10-17 11:24:00 +03:00
Dmitry Stogov
cefb228e15
Discard disasm symbols on opcache restart
2022-10-17 11:22:59 +03:00
Dmitry Stogov
c5364b851a
Fix crashes after opcache restart
2022-10-11 14:23:12 +03:00
Dmitry Stogov
e81b6bf018
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix typo
2022-10-05 21:39:37 +03:00
Dmitry Stogov
072dc3c857
Fix typo
2022-10-05 21:39:16 +03:00
Dmitry Stogov
5877b84056
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix register allocation (missing store)
2022-10-03 17:09:01 +03:00
Dmitry Stogov
ed652a514f
Fix register allocation (missing store)
...
This fixes oss-fuzz #52022
2022-10-03 17:08:11 +03:00
Dmitry Stogov
da28a6b497
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix abstract trace consisency for FE_FETCH instruction
2022-10-03 14:51:21 +03:00
Dmitry Stogov
5ca4113386
Fix abstract trace consisency for FE_FETCH instruction
2022-10-03 14:48:03 +03:00
Dmitry Stogov
aa179bf3dd
Force exit to VM
2022-09-29 15:27:38 +03:00
Ilija Tovilo
0aa5adb143
Fix invalid label before }
...
Will be fixed in C23 :)
Closes GH-9624
2022-09-27 23:27:17 +02:00
Dmitry Stogov
2568db287d
Wrap JIT compiler with zend_try to recover in case of memory overflow
2022-09-27 22:28:16 +03:00
wxue1
52f4ed16e0
Indirect call reduction for Jit code
...
Changing indirect call to direct call for Jit code
benefits the branch prediction, which gets 1% performance
gain in our workload.
Similarly, we change indirect jump to direct jump.
Signed-off-by: Su, Tao <tao.su@intel.com >
Signed-off-by: Wang, Xue <xue1.wang@intel.com >
2022-09-22 11:22:27 +01:00
Arnaud Le Blanc
466e4dc2a2
Check return value of zend_jit_trace_get_exit_addr() ( #9097 )
2022-09-09 10:50:03 +02:00
Dmitry Stogov
a516e2992d
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix ext/opcache/tests/jit/inc_obj_004.phpt failure introduced by fd74ee7e90
2022-08-29 12:35:46 +03:00
Dmitry Stogov
ce42dcf483
Fix ext/opcache/tests/jit/inc_obj_004.phpt failure introduced by fd74ee7e90
...
This should fix GH-9445
2022-08-29 12:30:14 +03:00
Dmitry Stogov
2a33280ceb
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
JIT: Make code generation to be consistent with register allocation
2022-08-22 19:55:10 +03:00
Dmitry Stogov
fd74ee7e90
JIT: Make code generation to be consistent with register allocation
...
Fixes ext/opcache/tests/jit/add_014.phpt with opcache.jit=1205
2022-08-22 19:53:33 +03:00
Dmitry Stogov
5762fc52c6
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Tracing JIT: Fix incorrect guard elimination
2022-08-22 15:39:47 +03:00
Dmitry Stogov
c9c51eb1f1
Tracing JIT: Fix incorrect guard elimination
...
Fixes oss-fuzz #49917
2022-08-22 15:38:41 +03:00
David Carlier
9360cd6add
Merge branch 'PHP-8.0' into PHP-8.1
2022-08-19 16:40:54 +01:00
David Carlier
52e312afb8
opcache jit fix message format for OpenBSD.
...
like macOs it requires `ll`.
Closes #9380 .
2022-08-19 16:40:29 +01:00
Dmitry Stogov
7ff71a0a55
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Tracing: Prevent recording types of variables used to pass zend_class_entry
2022-08-01 17:03:56 +03:00
Dmitry Stogov
2758ff2a77
Tracing: Prevent recording types of variables used to pass zend_class_entry
2022-08-01 17:02:53 +03:00
Dmitry Stogov
69c10aed58
Fix incorrect guard motion out of the loop
...
Fixes oss-fuzz #49579
2022-08-01 15:32:49 +03:00
Dmitry Stogov
e70d282077
JIT: Fix missing type stote
...
Fixes oss-fuzz #49402
2022-07-25 15:24:26 +03:00
Dmitry Stogov
cc465ba0bb
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix memory leak
2022-07-25 12:08:00 +03:00
Dmitry Stogov
44b86aee31
Fix memory leak
...
Fixes oss-fuzz #49272
2022-07-25 12:04:46 +03:00
Arnaud Le Blanc
f2381ae4ba
Fix JIT crash with large number of match/switch arms ( #8961 )
...
Switch statements may generate a large number of exit points. Once the max
number of exit points is reached, get_exit_addr() returns NULL. This was not
checked, and this resulted in a jump table with some 0 addresses.
2022-07-18 12:34:20 +02:00
Dmitry Stogov
af75eab0ef
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:09:14 +03:00
Dmitry Stogov
d66d477d6f
Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:08:18 +03:00
Dmitry Stogov
b7693360cb
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:13:03 +03:00
Dmitry Stogov
7cf6f17383
Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:10:46 +03:00
Dmitry Stogov
7e23c838e2
Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT
2022-06-27 16:41:53 +03:00
Dmitry Stogov
971b07ea60
JIT: Fix incorrect reference-counting
...
This fixes oss-fuzz #47937
2022-06-14 15:03:50 +03:00
Dmitry Stogov
70e0e1ada6
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
JIT: Fix missing register store
2022-06-14 13:59:47 +03:00
Dmitry Stogov
1cd8074743
JIT: Fix missing register store
...
This fixes oss-fuzz #48023
2022-06-14 13:57:44 +03:00
Dmitry Stogov
7ebda198ea
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix memory leak
2022-05-30 11:39:10 +03:00
Dmitry Stogov
3a8912fb7c
Fix memory leak
...
This fixes oss-fuzz #47648
2022-05-30 11:32:17 +03:00
Arnaud Le Blanc
69d263e2a1
Add JIT guards for INIT_METHOD_CALL when the method may be modified ( #8600 )
...
Non-polymorphic methods can be modified from one request to an other due to recompilation or conditional declaration.
Fixes GH-8591
Co-authored-by: Oleg Stepanischev <Oleg.Stepanischev@tatar.ru >
2022-05-27 13:15:15 +02:00
Dmitry Stogov
6c25413183
Add JIT guards for INIT_FCALL instructions and functions that may be modified
...
For methods we reuse mechanism of polymorphic calls.
For regular function we invalidate the whole root trace.
This fixes https://github.com/php/php-src/issues/8461
2022-05-12 18:44:12 +03:00