1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 20:22:36 +02:00
Commit Graph

1532 Commits

Author SHA1 Message Date
Ilija Tovilo
5fcc8d4cd1 Upgrade security branches to Ubuntu 22.04
20.04 goes out of security support in 2 months. Backporting various
commits.

See d98963a071
See af721c9c36
See 378b79b90c

Closes GH-17963
2025-03-06 15:24:15 +01:00
Dmitry Stogov
b0b39cdc3e Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
This will finally make the COMMUNTIY build of the PHP 8.1 build green.

See https://github.com/php/php-src/pull/16858#issuecomment-2509010556
Closes GH-17091
2024-12-09 16:59:41 +01:00
Dmitry Stogov
87107f8688 Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error 2023-11-22 21:11:49 -06:00
Dmitry Stogov
c60c2a0d67 Backport fix for GH-12512: JIT Assertion `info & (1 << type)' failed (#12660) 2023-11-13 13:26:17 +03:00
Dmitry Stogov
77a497d56a Don't JIT after fatal errors 2023-11-02 14:14:12 +03:00
Dmitry Stogov
455a967934 Backport fix for incorrect assumption about in-memory zval type 2023-10-31 11:56:01 +03:00
Dmitry Stogov
fbf4e196da Fixed regression intoduced by 76c41d27f9 2023-10-25 15:15:13 +03:00
Dmitry Stogov
76c41d27f9 Fixed GH-12482: Abortion with tracing JIT 2023-10-24 14:20:35 +03:00
Dmitry Stogov
89eb1c64a9 Fixed GH-11917: primitives seem to be passed via reference instead of by value under some conditions when JIT is enabled on windows (#12451) 2023-10-17 01:58:07 +03:00
Dmitry Stogov
dabced0fbb Fixed GH-12428: Assertion with function/tracing JIT 2023-10-16 15:11:56 +03:00
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