1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00
Commit Graph

5549 Commits

Author SHA1 Message Date
Jakub Zelenka
8e1cef4341 Do not check X-Powered-By header in FPM tester if expose_php off
Closes GH-9508
2022-09-29 15:27:33 +01:00
Jakub Zelenka
1ed4303957 Improve CS in FPM Tester Response 2022-09-29 15:24:00 +01:00
Jakub Zelenka
1e8fa6607d Rework FPM tests logging for better debugging 2022-09-27 17:27:43 +01:00
Jakub Zelenka
3503b1daa2 Fix bug #77780: "Headers already sent" when previous connection was aborted
This change primarily splits SAPI deactivation to module and destroy
parts. The reason is that currently some SAPIs might bail out
on deactivation. One of those SAPI is PHP-FPM that can bail out on
request end if for example the connection is closed by the client
(web sever). The problem is that in such case the resources are not
freed and some values reset. The most visible impact can have not
resetting the PG(headers_sent) which can cause erorrs in the next
request. One such issue is described in #77780 bug which this fixes
and is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
2022-08-29 22:25:53 +01:00
Jakub Zelenka
986e7319c5 Re-add fixed tests for GH-8885 2022-08-29 16:42:10 +01:00
Jakub Zelenka
bcdd9877e1 Fix GH-8885 tests on MacOS 2022-08-29 16:40:31 +01:00
Dmitry Menshikov
f92505cf24 Fix GH-8885: access.log with stderr writes logs to error_log after reload
This fix allows restoring the the original stderr so the logs are
correctly written.
2022-08-29 14:39:24 +01:00
David Carlier
e2a5428ca0 FPM fix strict prototype warnings.
Closes GH-8986.
2022-08-28 23:24:23 +01:00
David CARLIER
2a5b2cca85 Revert "FPM: Downgrade occasional "failed to acquire scoreboard" warning"
This reverts commit 3040f75f43.
2022-07-18 14:21:07 +01:00
Felix Wiedemann
3040f75f43 FPM: Downgrade occasional "failed to acquire scoreboard" warning
With request timeouts configured, php-fpm occasionally prints the
following warning:

   WARNING: failed to acquire scoreboard

This is happens when php-fpm checks the child scoreboards for timeouts,
but fails to acquire a lock immediately.  As this can (and does) occur
during normal operation, this commit downgrades this to a notice.
Closes #9019.
2022-07-18 12:40:16 +01:00
guoyiyuan
789a37f144 Prevent potential buffer overflow for large value of php_cli_server_workers_max
Fixes #8989.
Closes #9000.
2022-07-14 12:12:25 +01:00
Heiko Weber
bd6793372b FPM: Fix possible double free on configuration load failure.
Closes #8948.
2022-07-08 13:11:37 +01:00
David Carlier
b3569865b3 Fix the crypt sha apis build (with recent clang versions).
Removing the said subtraction by casting instead.
While at it fixing werror level on phpdbg too.

Closes #8897.
2022-07-01 05:33:12 +01:00
Heiko Weber
325ca31dcf FPM: zlog, fix free on wrong address for message prepend. 2022-06-27 23:34:58 +01:00
Christoph M. Becker
a8437d08a8 Fix GH-8827: Intentionally closing std handles no longer possible
We revert the commits which caused this regression from the PHP-8.0 and
PHP-8.1 branches for now.  We keep it in "master" because of PR #8833
which may offer a proper fix without BC break.
2022-06-20 18:01:02 +02:00
Jakub Zelenka
e330f443c9 Fix bug #67764: fpm: syslog.ident does not work 2022-06-19 20:05:49 +01:00
Heiko Weber
a83363e361 FPM: Fix use after free in fpm_evaluate_full_path
Closes #8796.
2022-06-16 12:18:01 +01:00
Levi Morrison
fa78e17724 Stop closing stderr and stdout streams (#8569)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:27:23 +02:00
Jakub Zelenka
23a2030438 Fix bug #72185: php-fpm writes empty fcgi record causing nginx 502
This issue might happen if there is change of the fcgi stream when
the buffer is full. Then the empty record is created which signals
end of stream which is incorrect.

The actual fix without a test was contributed by GitHub user @loveharmful
in GH-3198.
2022-05-10 21:36:55 +01:00
David CARLIER
ef06f0f50b Fix FPM ACL build check on MacOS
MacOS has got ACL support but without user/group support.
2022-04-29 20:39:22 +01:00
Jakub Zelenka
0df28869f6 Add skip for FPM resource heavy tests 2022-04-27 19:11:47 +01:00
David Carlier
ff90d42b8b Fix FPM kqueue handler fix remove callback typo
It avoids confusion on failed event.
2022-04-23 15:11:53 +01:00
Jakub Zelenka
d8612fb6b7 Fix bug #77023: FPM cannot shutdown processes
This change introduces subsequent kill of the process when idle process quit
(SIGQUIT) does not succeed. It can happen in some situations and means that FPM
is not able to scale down in dynamic pm. Using SIGKILL fixes the issue.
2022-04-22 20:51:02 +01:00
David Carlier
2f0918c638 Fix FPM socket clean up reallocation clang build warning 2022-04-15 22:20:15 +01:00
David Carlier
fc9fecbd09 Fix FPM zlog warning with var being uninitialized 2022-04-15 22:19:36 +01:00
Jakub Zelenka
33bb201b3e Fix bug #76003: FPM /status reports wrong number of active processe
The fix introduces early locking of scoreboard when it is updated
which prevents the race condition causing an incorrect number of
active processes being set.
2022-04-12 23:12:11 +01:00
Christoph M. Becker
e98a7a68b7 Fix bugtracker URL
The php-src bugtracker is now on Github.

Closes GH-8102.
2022-02-15 19:14:07 +01:00
Till Backhaus
29fe06fa59 Fix bug #76109: Implement fpm_scoreboard_copy
fpm_scoreboard_copy locks the scoreboard while copying the scoreboard and all
proc scoreboards. proc scoreboards are locked one by one while copying each
struct. The old implementation (inside fpm_handle_status_request) only briefly
locked the scoreboard while copying the scorebard.

Closes GH-7931

Co-authored-by: Jakub Zelenka <bukka@php.net>
2022-02-09 23:02:45 +00:00
David Carlier
c99a026c9c Fix memory leak on invalid port
Closes GH-7911.
2022-01-08 21:04:55 +01:00
David Carlier
cb3d858745 Fix buffer allocations in zlog_stream_set_msg_suffix()
If that code was used, there would be a UAF scenario.

Closes GH-7835.
2021-12-28 13:27:54 +01:00
Jakub Zelenka
81513e6285 Add skip for FPM process idle flaky test 2021-11-27 22:37:43 +00:00
Jakub Zelenka
2f8407f185 Increase read timeout in FPM process idle test 2021-11-20 20:42:19 +00:00
Jakub Zelenka
fc67967190 Increase script sleep in FPM process idle test 2021-11-20 20:42:19 +00:00
Nikita Popov
e81ad637f4 Update reflection test after stub change 2021-11-18 11:16:13 +01:00
Jakub Zelenka
ec3d4409a4 Merge branch 'PHP-7.4' into PHP-8.0 2021-11-14 20:10:42 +00:00
Jakub Zelenka
b2cf9b7ec7 Fix bug #81513 (Future possibility for heap overflow in FPM zlog)
This fixes currently unused code path in zlog that could lead to
the heap overflow in the future.
2021-11-14 20:08:57 +00:00
David Carlier
b1e6fdefd4 Fix leaks for AppArmor based distros in case the profile creation fails
Closes GH-7646.
2021-11-12 14:25:52 +01:00
Nikita Popov
b302bfabe7 Implement Stringable automatically for internal classes
Requiring all internal classes (including those from 3rd-party
extensions) to implement Stringable if they provide __toString()
is too error prone. Case in point, our _ZendTestClass test class
was not doing so, resulting in preloading test failures after
recent changes.

Instead we automatically implement Stringable, the same as we do
for userland classes. We still allow explicit implementations,
but ignore them (normally they would result in an error due to
duplicate interface implementation). Finally, we need to be
careful about not trying to implement Stringable on Stringable
itself.

In some cases this changes the interface order, in particular the
automatic Stringable implementation will now come first.
2021-11-05 10:22:04 +01:00
Jakub Zelenka
fadb1f8c1d Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
The main change is to store scoreboard procs directly to the variable sized
array rather than indirectly through the pointer.

Signed-off-by: Stanislav Malyshev <stas@php.net>
2021-10-18 15:06:36 -07:00
Jakub Zelenka
cb2021e5f6 Fix bug #81026 (PHP-FPM oob R/W in root process leading to priv escalation)
The main change is to store scoreboard procs directly to the variable sized
array rather than indirectly through the pointer.

Signed-off-by: Stanislav Malyshev <stas@php.net>
2021-10-17 20:16:10 -07:00
Christoph M. Becker
b7f3b67060 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81518: Header injection via default_mimetype / default_charset
2021-10-14 12:21:35 +02:00
Christoph M. Becker
365769366b Fix #81518: Header injection via default_mimetype / default_charset
We forbid setting these INI options to values containing NUL bytes, CR
or LF.

Closes GH-7574.
2021-10-14 12:16:19 +02:00
Lauri Kenttä
cdcdb33080 Fix #81496: CLI server logs wrong request method 2021-10-05 08:42:38 +02:00
Nikita Popov
a00d933242 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable failing FPM test
2021-10-04 23:31:31 +02:00
Nikita Popov
4c01bd2ade Disable failing FPM test
Test fails intermittently, e.g.:

https://dev.azure.com/phpazuredevops/PHP/_build/results?buildId=20597&view=ms.vss-test-web.build-test-results-tab&runId=475324&resultId=115501&paneView=debug

Possibly this is because the two requests end up being processed
in sequence and no second process is spawned.
2021-10-04 23:30:14 +02:00
Jakub Zelenka
9ed95846a3 Merge branch 'PHP-7.4' into PHP-8.0 2021-10-04 21:55:21 +01:00
Jakub Zelenka
66a655fdf4 Add the actual test for FPM prod idle timeout test with 6s sleep 2021-10-04 21:54:32 +01:00
Jakub Zelenka
2cd69115d5 Merge branch 'PHP-7.4' into PHP-8.0 2021-10-04 21:53:34 +01:00
Jakub Zelenka
edfb347019 Add FPM prod idle timeout test with 6s sleep 2021-10-04 21:50:57 +01:00
Nikita Popov
987aee10a9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Add FPM prod idle timeout test"
2021-10-04 10:16:53 +02:00