1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 07:58:20 +02:00
Commit Graph

60071 Commits

Author SHA1 Message Date
Nikita Popov e7de9b2091 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix func/class name use after free on opcache OOM condition
2021-09-14 12:03:03 +02:00
Nikita Popov 10e9f6b340 Fix func/class name use after free on opcache OOM condition
This can occur on opcache OOM conditions, where the function/class
names are not interned and the script does not get cached. In
that case the functions/classes get transferred from the persistent
script to the global tables, without incrementing the key refcount.
To mirror that, we should also not try to free the keys when freeing
the persistent script. For this by setting the number of elements
to zero, which will free only the hashtable structure itself.
2021-09-14 12:00:44 +02:00
Nikita Popov 1b376b06fb Fix BIND_STATIC may_throw check
This is supposed to index into arData, not the HashTable itself.
2021-09-14 10:09:32 +02:00
Tyson Andre 27976d7dc7 Merge branch 'PHP-8.0' into PHP-8.1 2021-09-13 21:18:56 -04:00
Tyson Andre 753645a6f8 Merge remote-tracking branch 'origin/PHP-7.4' into PHP-8.0 2021-09-13 21:00:53 -04:00
Tyson Andre b053192a03 Fix #81429: Handle resizing in SplFixedArray::offsetSet (#7487)
offsetSet did not account for the fact that the array may no longer exist after
the field is overwritten. This fixes that.

Add test of resizing both to the empty array and a smaller array - there should
be no valgrind warnings with a proper fix.

Alternate approach to #7486 (described in https://bugs.php.net/bug.php?id=81429)
2021-09-13 20:59:06 -04:00
Nikita Popov fe984c7cb5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Use wildcard for error message
2021-09-13 22:47:13 +02:00
Nikita Popov 5d702e33a2 Use wildcard for error message
This differs depending on build type.
2021-09-13 22:46:26 +02:00
Nikita Popov ba03c5fb4c Try to fix test 2021-09-13 21:07:46 +02:00
Dmitry Stogov ebd1a0a656 Properly check if BIND_STATIC may throw 2021-09-13 21:57:26 +03:00
Nikita Popov 8c601edada Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  BIND_STATIC may throw
2021-09-13 17:25:13 +02:00
Nikita Popov b610dce079 BIND_STATIC may throw
The evaluation of the initializer may throw. This could be refined
by checking whether the initializer is a constant AST. For now
just fix the miscompile.
2021-09-13 17:23:57 +02:00
Nikita Popov 133afe8591 Fix JIT call chain check without call opcode
The do_fcall opcode may have been optimized away if an opcode like
exit is present in the arguments. In that case the opcode scan
would go past the end of the op array.
2021-09-13 16:48:38 +02:00
Bob Weinand a8f06346ad Merge remote-tracking branch 'origin/PHP-8.0' into PHP-8.1 2021-09-13 16:15:55 +02:00
Bob Weinand 12b0f1b7cc Fix #81435 Observer current_observed_frame may point to an old (overwritten) frame
Ensure current_observed_frame always points to an actually observed frame.
This solution has a caveat of being O(stack size), with the worst case occurring if there are a lot of frames between the current and previous observed frames.
An O(1) solution would require keeping track of the previous observed frame, which would require some additional frame attached metadata, which is best not attempted in an already released version.
2021-09-13 15:58:58 +02:00
Nikita Popov 86d470f3e0 Reset CE cache slots on opcache reset
Permanent opcache interned strings could have ce_cache pointing to
non-permanent map_ptr slots. On reset, those would be left dangling.
Clear any non-permanent ce_cache slots when the interned string
state is reset.

This was fun to debug...
2021-09-13 15:20:34 +02:00
Remi Collet b3646440b1 Don't rely on libgd unused constants 2021-09-13 14:48:13 +02:00
Christoph M. Becker 311b1de649 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81424: PCRE2 10.35 JIT performance regression
2021-09-13 14:38:37 +02:00
Christoph M. Becker 12e79ddae4 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81424: PCRE2 10.35 JIT performance regression
2021-09-13 14:35:49 +02:00
Christoph M. Becker a2471383fe Fix #81424: PCRE2 10.35 JIT performance regression
We backport the respective upstream fix[1] to our bundled pcre2lib.

[1] <https://github.com/PhilipHazel/pcre2/commit/dc5f96663597572f694147aeec3525003c351123>

Closes GH-7484.
2021-09-13 14:34:13 +02:00
Christoph M. Becker 9ffa3f9ba3 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:14:32 +02:00
Christoph M. Becker 6fbdf69628 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:13:09 +02:00
Viktor 424c265478 Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
We must only remove the attribute id, if the user requested that.

Closes GH-7482.
2021-09-13 12:11:36 +02:00
Nikita Popov 9042c7aac6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef value in assign_dim jit
2021-09-13 11:10:03 +02:00
Nikita Popov e7663785a7 Handle undef value in assign_dim jit
We should report the undefined variable here and convert it to
null. Passing on undef is particularly insidious here, because
a write_dimension handler may insert it into a hash table
(observed with WeakMap).
2021-09-13 11:09:00 +02:00
Dmitry Stogov 971142a12a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed exit from CALL VM with GCC Global Register Variables
2021-09-13 11:40:45 +03:00
Hao Sun cfb21e8dc1 JIT: Fixed exit from CALL VM with GCC Global Register Variables
PHP JIT supports three configurations: HYRBID, CALL with global register
variables feature(CALL+GRV for short), and CALL+noGRV.

CALL+GRV mode can be built with the following commands:

```
  php Zend/zend_vm_gen.php --with-vm-kind=CALL
  ./buildconf -f; ./configure; make
```

About 230 test cases failed for tracing JIT under CALL+GRV mode on both
x86 and arm64 machines.

For CALL+GRV mode, the condition to determine whether the execution of
an oparray is finished, is "opline == NULL". See function execute_ex()
around line "if (UNEXPECTED(!OPLINE)) {".

However, such cleanup operation is missing for the JIT wrapper
zend_jit_trace_counter_helper(), and the trace_halt stub function.

Tests:
1. test cases: all .phpt test cases under "Zend/tests/ tests/
ext/opcache/tests/jit/".
2. both JIT/x86 and JIT/arm64: function JIT, tracing JIT and tracing JIT
with "--repeat 3"
3. execution modes: NTS/ZTS, HYBRID/CALL+GRV/CALL+noGRV

In my local test, these test cases passed under all JIT configrations.
2021-09-13 11:35:12 +03:00
Jakub Zelenka 43f0141d74 Make OpenSSL tests less dependent on system config
It fixes dependencies on system config if running tests with OpenSSL 3.0
2021-09-12 20:30:02 +01:00
Remi Collet 6ee96f095a fix [-Wmaybe-uninitialized] build warnings 2021-09-10 15:57:56 +02:00
Nikita Popov 5cae6b9b0d Check that POST_INC/DEC has use in DFA optimization
We'd have usually converted it into a PRE_INC if there is no use,
but that's not guaranteed. If there is no use at this point, make
sure we don't try to use the sentinel value.
2021-09-09 15:48:51 +02:00
Nikita Popov f86a963199 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Also make sure binary op operands can't be undef
2021-09-09 15:09:02 +02:00
Nikita Popov 8c3d33a054 Also make sure binary op operands can't be undef
Otherwise we will end up passing undef to xyz_function etc, which
is not permitted.
2021-09-09 15:08:08 +02:00
Nikita Popov b9a6ec2097 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Check whether expected types are present for compound op jit
2021-09-09 14:33:10 +02:00
Nikita Popov bac054dbf3 Check whether expected types are present for compound op jit
zend_jit_long_math_helper() implicitly assumes that the operands
MAY_BE_LONG (but can also have additional types). It will normally
only be called if this is guaranteed. However, for compound
array/object assignment ops this was not check. Generalize the
existing check for assign_op to apply to these as well.

Of course, we could also make the code support this correctly,
but I don't think it makes sense to JIT these if the type we're
specializing for is not present.

Closes GH-7481.
2021-09-09 14:32:14 +02:00
Dmitry Stogov 679bfb1522 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: fixed MUL+SEND optimization when MUL throws an exception
2021-09-08 17:57:21 +03:00
Dmitry Stogov 06275d940c JIT: fixed MUL+SEND optimization when MUL throws an exception 2021-09-08 17:53:23 +03:00
Nikita Popov f2bb739eeb Apply fix to ARM JIT as well
This is the same change as e22fb46127,
but for the ARM JIT implementation.
2021-09-08 15:46:35 +02:00
Nikita Popov 4bccf36973 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Save register before throwing undef var notice
2021-09-08 14:46:08 +02:00
Nikita Popov e22fb46127 Save register before throwing undef var notice
Otherwise we may clobber it while throwing the undef var notice.
This makes the implementation for assign_dim_op line up with
fetch_dim.
2021-09-08 14:45:49 +02:00
George Peter Banyard be2500f229 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix param name order for Phar::copy()
2021-09-08 12:32:58 +01:00
George Peter Banyard 0d0c9acafb Fix param name order for Phar::copy() 2021-09-08 12:31:09 +01:00
Nikita Popov 8d069d266a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix jump after zend_jit_invalid_property_assign()
2021-09-08 12:29:05 +02:00
Nikita Popov b0e16f0e4f Fix jump after zend_jit_invalid_property_assign()
This is supposed to go to the FREE_OP_DATA, currently it crashes.
2021-09-08 12:27:54 +02:00
Máté Kocsis a5e5483439 Remove extra space before param default values 2021-09-08 12:24:47 +02:00
Dmitry Stogov 487eface86 Fixed ARM JIT failure introduced in d4ed6b635f 2021-09-07 17:18:35 +03:00
Dmitry Stogov 7fcb45dffa JIT: prefer string reallocation instead of allocation/memcpy/deallocation 2021-09-07 15:28:15 +03:00
Dmitry Stogov aed94e2ca8 JIT: improved code for protected properties access 2021-09-07 13:18:14 +03:00
Dmitry Stogov 1bb6cf5396 JIT: eliminate check for undefined constant if there is a persistent constant 2021-09-07 13:17:16 +03:00
Dmitry Stogov d4ed6b635f JIT: Update run_time_cache slot in zend_jit_find_func helper 2021-09-07 13:13:47 +03:00
Máté Kocsis c8f858ef49 Add more specific array return type hints for various extensions - part 4 (#7469) 2021-09-06 17:14:52 +02:00