1
0
mirror of https://github.com/php/php-src.git synced 2026-04-14 11:32:11 +02:00
Commit Graph

5473 Commits

Author SHA1 Message Date
Max Kellermann
efd5ecb0f2 Zend/Optimizer/zend_inference: make several pointers const
This allows removing several deconst casts from the JIT.
2023-01-04 12:59:16 +00:00
Max Kellermann
10d43c40dd ext/opcache/zend_shared_alloc: change "locked" check to assertion
Calling zend_shared_alloc() without holding the lock is always a bug,
not a fatal runtime error.
2023-01-02 15:49:04 +00:00
Max Kellermann
e1a25ff2ed ext/opcache/zend_shared_alloc: add assertions on "locked" flag
Let the PHP process crash if a bug causes incorrect locking calls.
2023-01-02 15:49:04 +00:00
David Carlier
383053c4aa Merge branch 'PHP-8.2' 2022-12-29 12:22:21 +00: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
Dmitry Stogov
ca5f668f7c Added missed return 2022-12-29 12:40:46 +03:00
David Carlier
f7a28c4145 Merge branch 'PHP-8.2' 2022-12-26 21:19:23 +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
Dmitry Stogov
f922597b51 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix memory leak because of incorrect optimization
2022-12-26 13:22:02 +03:00
Dmitry Stogov
0464524292 Fix memory leak because of incorrect optimization
Fixes oss-fuzz #54488
2022-12-26 13:20:55 +03:00
Ilija Tovilo
292f69b345 Merge branch 'PHP-8.2'
* PHP-8.2:
  Add a regression test for auto_globals_jit=0 with preloading on
2022-12-22 17:42:37 +01:00
Ilija Tovilo
db48f49888 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add a regression test for auto_globals_jit=0 with preloading on
2022-12-22 17:42:27 +01:00
Niels Dossche
bbad29b9c1 Add a regression test for auto_globals_jit=0 with preloading on 2022-12-22 17:42:11 +01:00
Ilija Tovilo
08fb7f93a1 Merge branch 'PHP-8.2'
* PHP-8.2:
  Initialize ping_auto_globals_mask to prevent undefined behaviour
2022-12-22 15:00:14 +01:00
Ilija Tovilo
c714e626c8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Initialize ping_auto_globals_mask to prevent undefined behaviour
2022-12-22 15:00:00 +01:00
Niels Dossche
c4487b7a12 Initialize ping_auto_globals_mask to prevent undefined behaviour
Closes GH-10121
2022-12-22 14:59:24 +01:00
Arnaud Le Blanc
c46a0ce198 Merge branch 'PHP-8.2'
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  ext/opcache/jit/zend_jit: fix inverted bailout value in zend_runtime_jit() (#10144)
2022-12-21 14:56:26 +01: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
Arnaud Le Blanc
a11c8a3039 Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Jorg Adam Sowa
77ee92a50c Remove unnecessary usage of CONST_CS
Closes GH-9685.
2022-11-28 17:12:07 +01:00
Arnaud Le Blanc
1cba98ebe9 Merge branch 'PHP-8.2'
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  Do not resolve constants on non-linked class during preloading (#9975)
2022-11-25 14:37:55 +01:00
Arnaud Le Blanc
5563535e97 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  Do not resolve constants on non-linked class during preloading (#9975)
2022-11-25 14:11:52 +01:00
Arnaud Le Blanc
91b3b58f71 Do not resolve constants on non-linked class during preloading (#9975)
Fixes GH-9968
2022-11-25 14:02:45 +01:00
Dmitry Stogov
ff85649431 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix a memory leak in tracig JIT when the same closure is called through Closure::call() and natively.
2022-11-22 12:29:36 +03:00
Dmitry Stogov
45cb3f917a Fix a memory leak in tracig JIT when the same closure is called through Closure::call() and natively.
Closure::call() makes a temporary copy of original closure function, modifies its
scope, resets ZEND_ACC_CLOSURE flag and call it through zend_call_function().
As result the same function may be called with and without
ZEND_ACC_CLOSURE flag, that confuses JIT and may lead to memory leak or
even worse memory errors.

The patch allocates "fake" closure object and keep ZEND_ACC_CLOSURE flag
to always behave in the same way.
2022-11-21 17:41:16 +03:00
David CARLIER
3660bc31de opcache fixing w/x pages creation on freebsd 13.1 and above.
By default, the system allows these but admin can disable them system wide.
However the procctl api permits to control it per process.

Closes GH-9896.
2022-11-18 19:22:00 +00:00
Dmitry Stogov
a6a80d8ab2 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix memory leak
2022-11-14 12:36:00 +03: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
Ilija Tovilo
6e5b989886 Remove unused PHP 8.1 BC layer in JIT (#9937) 2022-11-11 20:03:53 +01:00
Bob Weinand
2cab4874ad Merge branch 'PHP-8.2' 2022-11-09 16:36:50 +01:00
Bob Weinand
4052bbf0e3 Fix opcache preload with observers enabled
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-11-09 16:36:28 +01:00
Dmitry Stogov
5e23cf9381 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix memory leak
2022-11-07 11:10:05 +03:00
Dmitry Stogov
de4b502fef Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak
2022-11-07 11:08:54 +03:00
Dmitry Stogov
f31f464cec Fix memory leak
Fixes oss-fuzz #52999
2022-11-07 11:07:58 +03:00
Bob Weinand
98646e3e21 Merge branch 'PHP-8.2' 2022-11-02 15:33:17 +01:00
Bob Weinand
b30448f48f Fix observing inherited internal functions
Fixes GH-9871
2022-11-02 15:33:04 +01:00
Ilija Tovilo
3daa8a93ee Fix default_object_handlers pointing to invalid memory with file_cache
Closes GH-9596
2022-10-27 10:48:31 +02:00
Ilija Tovilo
537a104f14 Fix user path in test 2022-10-25 13:03:55 +02:00
Dmitry Stogov
865f2c026e Merge branch 'PHP-8.2'
* PHP-8.2:
  opcache: fix syntax error introduced in 261a08af65 (#9821)
2022-10-24 20:43:31 +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
Kévin Dunglas
af75eaf9bf opcache: fix syntax error introduced in 261a08af65 (#9821) 2022-10-24 20:42:55 +03:00
Dmitry Stogov
a26d83a1d0 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed test
  JIT: Fix incorrect EX(opline) override
2022-10-24 12:10:15 +03:00
Dmitry Stogov
e0d9a29958 Fixed test 2022-10-24 12:10:08 +03:00
Dmitry Stogov
17706c3e88 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  JIT: Fix incorrect EX(opline) override
2022-10-24 12:03:36 +03:00
Dmitry Stogov
261a08af65 JIT: Fix incorrect EX(opline) override
Fixes oss-fuzz #52674
2022-10-24 12:02:28 +03:00
Bob Weinand
18cb372afd Merge branch 'PHP-8.2' 2022-10-22 22:09:21 +00:00