1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

22 Commits

Author SHA1 Message Date
Petr Sumbera
ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
Ilija Tovilo
6173a9a109 VAR|TMP overhaul (GH-20628)
The aim of this PR is twofold:

- Reduce the number of highly similar TMP|VAR handlers
- Avoid ZVAL_DEREF in most of these cases

This is achieved by guaranteeing that all zend_compile_expr() calls, as well as
all other compile calls with BP_VAR_{R,IS}, will result in a TMP variable. This
implies that the result will not contain an IS_INDIRECT or IS_REFERENCE value,
which was mostly already the case, with two exceptions:

- Calls to return-by-reference functions. Because return-by-reference functions
  are quite rare, this is solved by delegating the DEREF to the RETURN_BY_REF
  handler, which will examine the stack to check whether the caller expects a
  VAR or TMP to understand whether the DEREF is needed. Internal functions will
  also need to adjust by calling the zend_return_unwrap_ref() function.

- By-reference assignments, including both $a = &$b, as well as $a = [&$b]. When
  the result of these expressions is used in a BP_VAR_R context, the reference
  is unwrapped via a ZEND_QM_ASSIGN opcode beforehand. This is exceptionally
  rare.

Closes GH-20628
2026-01-31 19:44:56 +01:00
Ilija Tovilo
4f91af38cc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix stack overflow detection for variable compilation
2025-01-29 23:28:16 +01:00
Ilija Tovilo
333f5dd848 Fix stack overflow detection for variable compilation
Closes GH-17623
2025-01-29 23:27:27 +01:00
Dmitry Stogov
ccc6c0f78c Fix GH-15709: Crashing tests on Windows x64 (#17095)
This is a quick fix for the problem.
It'll work while all the JIT-ed functions have the same "fixed stack frame".
Unwinder uses hard-coded unwind data for this "fixed stack frame".

* Preallocate space for Win64 shadow args

* typo

* Setup unwinder for JIT functions

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit 7cc327fd5a.

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit bdde797159.

* Revert "Dynamically xfail test cases which fail on CI (GH-15710)"

This reverts commit 6d5962074f.

* Remove XFAIL sections

* Add hard-coded SEH unwind data for EXITCALL

* Fix unwind data

* Fix Windows multi-process support

* Typo
2024-12-13 02:05:45 +03:00
Arnaud Le Blanc
443aa29dbe Support stack limit in phpdbg SAPI
Fixes GH-16041
Closes GH-16055
2024-10-03 15:22:51 +02:00
Niels Dossche
577eb68212 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:20 +02:00
Niels Dossche
bd724bdf42 Fix GH-15169: stack overflow when var serialization in ext/standard/var
Adding a stack check here as I consider serialization to be a more
sensitive place where erroring out with an exception seems appropriate.

Closes GH-16159.
2024-10-02 21:30:59 +02:00
Christoph M. Becker
6d5962074f Dynamically xfail test cases which fail on CI (GH-15710)
This is a stop-gap measure for GH-15709 to keep CI green.
2024-09-02 18:23:52 +02:00
Ilija Tovilo
5c739acb2a [skip ci] Mark stack limit tests with high memory limit as slow 2024-08-09 20:29:58 +02:00
Arnaud Le Blanc
0bd260218b Fix stack limit on ASAN/MSAN (#14771)
Increase the reserved stack size in ASAN builds, as instrumentation use more stack.
Increase the max allowed stack size in some tests, and enable these tests under ASAN.
Use __builtin_frame_address(0), instead of some stack variable, when we need a stack address, as ASAN may store local variables outside of the real stack.
2024-07-03 19:23:34 +02:00
David CARLIER
eaaffae555 zend_call_stack sort of GH-13358 follow-up. (#13368)
for threaded context, it solely uses a new api only available on
illumos.
Here using a common older api to get the stack info for the current
thread.
while at it, completing stack_limit_010 test for these platforms.
2024-02-16 14:01:03 +00:00
David Carlier
b320aabc5e zend call stack fixing stack limit for macOs arm64.
8MB sounded a prudent size for older 10.9 macOs release, however
with newer mac with arm64, it triggers a stack overflow.

close GH-13319
2024-02-05 19:32:29 +00:00
Arnaud Le Blanc
3c3aba11be Merge branch 'PHP-8.3'
* PHP-8.3:
  WS
  Clarify the stack limit exception message
  Fix GH-12643: Stack limit tests failing on ppc64le
2023-12-10 13:27:13 +01:00
Arnaud Le Blanc
6aa70b577d WS 2023-12-10 13:24:49 +01:00
Arnaud Le Blanc
b1516d95e0 Clarify the stack limit exception message
Make it clearer why the size is not exactly zend.max_allowed_stack_size
2023-12-10 13:20:21 +01:00
Arnaud Le Blanc
dad6912b99 Fix GH-12643: Stack limit tests failing on ppc64le
These tests were setting zend.max_allowed_stack_size to a small value. On ppc64le
this value is too small and the limit may be reached too soon.
2023-12-10 13:20:21 +01:00
Ilija Tovilo
f39b5c4c25 Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Arnaud Le Blanc
72a163aa90 Add stack limit check in zend_eval_const_expr() (#11424) 2023-07-07 14:18:15 +02:00
Dmitry Stogov
68381457cc Fix test failures when PHP is compiled without ZEND_CHECK_STACK_LIMIT
(e.g. 32-bit CLANG build with address sanitizer)
2023-01-24 09:55:47 +03:00
Arnaud Le Blanc
cf77762970 Skip tests under MSAN
Stack overflows can be detected as long as C stack frames between two
execute_ex() calls use less than zend.reserved_stack_size bytes of stack.

The default value of zend.reserved_stack_size accounts for the largest stack
users, but MSAN instrumentation increases usage considerably: php_pcre2_match
uses more than 200KiB of stack in some MSAN build, compared to 20KiB without MSAN
according to -fstack-usage.
2022-12-19 21:41:48 +01:00
Arnaud Le Blanc
a11c8a3039 Limit stack size (#9104) 2022-12-16 17:44:26 +01:00