1
0
mirror of https://github.com/php/php-src.git synced 2026-04-08 00:22:52 +02:00
Commit Graph

1803 Commits

Author SHA1 Message Date
Dmitry Stogov
e50ed0f1a2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect VM stack overflow checks elimination
2023-06-20 12:00:20 +03:00
Dmitry Stogov
1a96d64828 Fixed incorrect VM stack overflow checks elimination 2023-06-20 11:59:36 +03:00
Dmitry Stogov
724e64fbda Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed deoptimization info for interrupt handler
2023-06-06 13:30:21 +03:00
Dmitry Stogov
8f06febedf Fixed deoptimization info for interrupt handler 2023-06-06 13:29:55 +03:00
Ilija Tovilo
5b033b0def Fix zend_jit_stop_counter_handlers() performance issues with protect_memory=1
The function repeatedly calls mprotect() which is extremely slow. In our
community build, the Laravel tests went from ~6 minutes to ~4 hours. This issue
only occurs with opcache.protect_memory=1.

Closes GH-11323
2023-05-26 10:55:11 +02:00
Dmitry Stogov
c155949905 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-11127 (JIT fault)
2023-05-02 20:33:19 +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
7e50735140 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  JIT: Fixed inaccurate range inference usage for UNDEF/NULL/FALSE
2023-05-02 12:04:03 +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
e14ac1caee Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Allow FETCH_OBJ_W and FETCH_STATIC_PROP_W to return INDIRECT/UNDEF zval for uninitialized typed properties (#11048)
2023-04-10 23:25:08 +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
962aac698e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:46 +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
ae39069051 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix module shutdown crash during ZTS JIT shutdown
2023-03-13 20:12:30 +01: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
ce2000d9be Merge branch 'PHP-8.1' of github.com:php/php-src into PHP-8.2 2023-03-13 12:39:15 +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
1978a7b393 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10709: UAF in recursive AST evaluation
2023-03-06 14:58:25 +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
8b70393c23 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-03 12:44:33 +00: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
7934a0fcfb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:29 +01: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
240c120cbc Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638)
2023-02-21 09:26:10 +03:00
Dmitry Stogov
70ff10af72 Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638) 2023-02-21 09:25:51 +03:00
Dmitry Stogov
388d784154 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion
2023-02-20 19:44:22 +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
David Carlier
81aedad452 opcache/pcntl/cli: Fixes few functions signatures. 2023-02-09 19:57:48 +00:00
Dmitry Stogov
d948b858de Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
2023-02-07 16:09:46 +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
Dmitry Stogov
8ad81c0e8c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types (#10527)
2023-02-07 13:38:39 +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
29efbe593d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix possible exit_counters memory leak in ZTS build
2023-02-06 18:37:24 +03:00
Dmitry Stogov
a21195650e Fix possible exit_counters memory leak in ZTS build 2023-02-06 18:35:06 +03:00
Dmitry Stogov
733b102759 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect compilation of FE_FETCH with predicted empty array
2023-01-19 07:42:01 +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
757e269b89 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10271: Incorrect arithmetic calculations when using JIT
2023-01-16 14:51:42 +03:00
Dmitry Stogov
42eed7bb4e Fix GH-10271: Incorrect arithmetic calculations when using JIT 2023-01-16 14:51:26 +03:00
Dmitry Stogov
d13b3b6aa7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/opcache/jit/zend_jit_trace: fix memory leak in _compile_root_trace() (#10146)
2023-01-09 09:51:00 +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
David Carlier
07bf42df41 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-29 12:21:13 +00: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
David Carlier
381d0ddc20 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-26 21:18:31 +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
Arnaud Le Blanc
f1c345394b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  ext/opcache/jit/zend_jit: fix inverted bailout value in zend_runtime_jit() (#10144)
2022-12-21 14:55:36 +01: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
6cbc91151a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak
2022-11-14 12:35:49 +03:00
Dmitry Stogov
a8bd342397 Fix memory leak
Fizes oss-fuzz #53143
2022-11-14 12:35:09 +03:00
Dmitry Stogov
6567d49726 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  opcache: fix syntax error introduced in 261a08af65 (#9821)
2022-10-24 20:43:18 +03:00