1
0
mirror of https://github.com/php/php-src.git synced 2026-04-06 15:43:13 +02:00
Commit Graph

1522 Commits

Author SHA1 Message Date
Dmitry Stogov
2297e8c143 Fixed possible use-after-free 2023-10-10 00:01:03 +03:00
Niels Dossche
fb6838770c Fix GH-12380: JIT+private array property access inside closure accesses private property in child class
For private fields, the scope has to be taken into account, otherwise
the property info may come from the wrong ce.

Closes GH-12381.
2023-10-09 22:10:05 +02:00
Dmitry Stogov
36b2c5dc88 Fix GH-12364: JIT leak in Symfony TranslationDebugCommandTest (#12394) 2023-10-09 23:07:34 +03:00
Dmitry Stogov
44a7016049 Fix incorrect trace type inference
Fixes GH-12365
2023-10-09 22:57:31 +03:00
Dmitry Stogov
5a8f96b0bb Fixed GH-12382: JIT Index invalid or out of range error 2023-10-09 11:20:18 +03:00
Dmitry Stogov
be0245c756 Fixed tracing JIT support for CALLABLE_CONVERT (#12156) 2023-09-08 18:27:13 +03:00
Dmitry Stogov
1a96d64828 Fixed incorrect VM stack overflow checks elimination 2023-06-20 11:59:36 +03:00
Dmitry Stogov
8f06febedf Fixed deoptimization info for interrupt handler 2023-06-06 13:29:55 +03:00
Dmitry Stogov
ed0b593c11 Fixed GH-11127 (JIT fault)
* Fixed GH-11127 (JIT fault)

* Added test

* Add new line
2023-05-02 20:32:48 +03:00
Dmitry Stogov
25ad171f63 JIT: Fixed inaccurate range inference usage for UNDEF/NULL/FALSE
Fixes oss-fuzz #58459
2023-05-02 12:02:20 +03:00
Dmitry Stogov
0c65b396d6 Allow FETCH_OBJ_W and FETCH_STATIC_PROP_W to return INDIRECT/UNDEF zval for uninitialized typed properties (#11048) 2023-04-10 23:19:17 +03:00
Dmitry Stogov
8a749c79d0 Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference 2023-04-03 18:15:41 +03:00
Niels Dossche
b3e28e2290 Fix module shutdown crash during ZTS JIT shutdown
Commit a21195650e fixed a leak by adding a TSRM destructor for the
JIT globals in ZTS mode. In case the main thread shuts down the TSRM, it
will call all the destructors. The JIT globals destructor will be
invoked, but will always access the main thread globals using JIT_G.
This means that instead of freeing the JIT globals in the different
threads, the one in the main thread is freed repeatedly over and over,
crashing PHP. Fix it by always passing the pointer instead of relying on
JIT_G.

Closes GH-10835.
2023-03-13 20:12:13 +01:00
Bob Weinand
1015f1ff61 Add test, fix x86 JIT
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-03-13 12:36:59 +01:00
Bob Weinand
c53e8d3e30 Handle zend_execute_internal in JIT 2023-03-13 12:36:59 +01:00
Ilija Tovilo
7202fe16b7 Fix GH-10709: UAF in recursive AST evaluation
Fixes https://oss-fuzz.com/testcase-detail/6445949468934144
Closes GH-10718
2023-03-06 14:55:34 +01:00
David Carlier
ffc2a53a9b Fix GH-10728: opcache capstone header's inclusion.
Remove capstone include folder.
For most of the supported systems it worked fine somehow despite
 the pkg-config --cflags, but is always include it even on Linux.

Closes GH-10732.
2023-03-03 12:43:12 +00:00
Ilija Tovilo
df93146a15 Fix missing readonly modification error with inc/dec in JIT
Closes GH-10746
2023-03-02 11:29:53 +01:00
Dmitry Stogov
70ff10af72 Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638) 2023-02-21 09:25:51 +03:00
Dmitry Stogov
08e7591206 Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion 2023-02-20 19:42:35 +03:00
Max Kellermann
131b862ac0 ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
Commit a21195650e added a TSRM destructor, but that destructor
will get called by tsrm_shutdown(), which is after opcache.so has
already been unloaded, resulting in a shutdown crash, e.g.:

  #0  0x00007fad01737500 in ?? ()
  #1  0x000055ac54e723c4 in tsrm_shutdown () at TSRM/TSRM.c:194
  #2  0x000055ac54c42180 in main (argc=80, argv=0x55ac57bc14d0) at sapi/cli/php_cli.c:1388

By calling ts_free_id() before opcache.so gets unloaded, we can easily
fix this crash bug.
2023-02-07 16:09:17 +03:00
Max Kellermann
afbb28dfb7 ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types (#10527)
* ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types

Regression by commit a21195650e

* TSRM/win32: fix ts_allocate_dtor cast

The dtor was casted to ts_allocate_ctor; luckily, ts_allocate_dtor and
ts_allocate_ctor just happen to be the same type.
2023-02-07 13:38:17 +03:00
Dmitry Stogov
a21195650e Fix possible exit_counters memory leak in ZTS build 2023-02-06 18:35:06 +03:00
Dmitry Stogov
7d68f9128e Fix incorrect compilation of FE_FETCH with predicted empty array
Fixes ext/opcache/tests/sccp_loop_var_free.phpt with opcache.jit=1205
and opcache.optimization_level=0
2023-01-19 07:40:24 +03:00
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