Commit Graph

5084 Commits

Author SHA1 Message Date
Nikita Popov
4b860c06ed Revert "Display a message if select in FPM test timeouts"
This reverts commit e2361498d5.

Ooops, this occurs normally during some tests, but I didn't notice
because I have slow tests disabled...
2020-01-08 16:31:33 +01:00
Nikita Popov
e2361498d5 Display a message if select in FPM test timeouts 2020-01-08 15:57:05 +01:00
Jakub Zelenka
ac042f839f Fix bug #78916 (php-fpm 7.4.0 don't send mail via mail()) 2019-12-08 17:57:17 +00:00
Jakub Zelenka
67cd4271e9 Fix bug #78889 (php-fpm service fails to start) 2019-12-01 17:13:20 +00:00
George Wang
99b8e67615 Merge branch 'PHP-7.3' into PHP-7.4 2019-11-21 17:58:44 -05:00
George Wang
e981f5af51 Merge branch 'PHP-7.2' into PHP-7.3 2019-11-21 17:58:16 -05:00
George Wang
c7141412ce Added environment LSAPI_CLEAN_SHUTDOWN to control clean shutdown. Update SAPI version to LiteSpeed v7.6 . 2019-11-21 17:57:50 -05:00
Maksim Nikulin
e37bd5dcc2 Do not let PHP-FPM children miss SIGTERM, SIGQUIT
Postpone signal delivery while spawning children.
Prevent the following case:

- Reload (reexec) is in progress.
- New master is forking to start enough children for pools
  where `pm` is not `on-demand`.
- Another `SIGUSR2` is received by the master process.
- Master process switches to reloading state.
- Some child has not set its own signal handlers.
- `SIGQUIT` and `SIGTERM` sent by master process are caught
  by signal handler set by master process and so they are ignored.
- A child is running, it has no reason to finish

Before pull request #4465 this scenario could cause deadlock,
however with 0ed6c37140 reload finishes after `SIGKILL`.

Use sigprocmask() around fork() to avoid race of delivery signal to children
and setting of own signal handlers.

Fixes bug #76601
2019-11-17 14:46:56 +00:00
Stanislav Malyshev
59953efc09 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:27 -07:00
Stanislav Malyshev
57b4dcbe77 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:19 -07:00
Stanislav Malyshev
4b5cdda0c7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043)
  bump versions after release
  set versions for release
2019-10-21 13:17:09 -07:00
Jakub Zelenka
ab061f95ca Fix bug #78599 (env_path_info underflow can lead to RCE) (CVE-2019-11043) 2019-10-20 22:50:04 -07:00
Maksim Nikulin
d537ae73e0 Skip fpm bug #74083 test on Windows
Have not expected side effects of `include`.
2019-10-20 16:08:55 +01:00
Maksim Nikulin
2f9f409156 Add (slow) test for fpm concurrent reloads #74083 2019-10-20 16:08:55 +01:00
Maksim Nikulin
ae5154c6c6 Block signals during fpm master initialization
Fix PHP-FPM failure in the case of concurrent reload attempts.

Postpone signal delivery to the fpm master process till proper signal
handlers are set. Prevent the following case:

- Running master process receives `SIGUSR2` and performs `execvp()`.
- Another `SIGUSR2` is arrived before signal handlers are set.
- Master process dies.
- Requests to the HTTP server handled by PHP-fpm can not be served
  any more.

Block some signals using `sigprocmask()` before `execvp()` and early
in the `main()` function. Unblock signals as soon as proper
handlers are set.

Fixes bug #74083
2019-10-20 16:08:55 +01:00
Tyson Andre
38f388fba4 Fix miscellaneous typos in docs 2019-10-19 19:19:28 +02:00
Dmitry Stogov
b64a182233 Revert "Link executable files using non PIC object files. This reduces PIC overhead and improves performance."
This reverts commit eef85229d0.
2019-10-10 16:28:59 +03:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Nikita Popov
27f5785363 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-30 12:54:18 +02:00
Sergei Turchanov
e546d721e8 Fix #78413: php-fpm request_terminate_timeout does not take effect after fastcgi_finish_request
To retain legacy behavior I decided to add an option to control request
termination logic. If request_terminate_timeout_track_finished is set,
then request will be tracked for time limits even after
fastcgi_finish_request was called.

This patch depends on the fix provided in BUG 78469 (otherwise php-fpm
workers listening on named pipes on Windows will be erroneously terminated)
(PR #4636)
2019-09-30 12:54:09 +02:00
Nikita Popov
f2826954ac XFAIL sapi/fpm/tests/log-bwd-multiple-msgs-stdout-stderr.phpt
This is supposed to be addressed by GH-4007, but that seems stalled
for now.
2019-09-27 11:18:50 +02:00
Nikita Popov
1a5f04688e Merge branch 'PHP-7.3' into PHP-7.4 2019-09-17 12:19:45 +02:00
Nikita Popov
3a2fa489dd Merge branch 'PHP-7.2' into PHP-7.3 2019-09-17 12:19:39 +02:00
Drakano
252ebce0d7 Add tilde to allowed status/ping path
Because of user specific webdirs it should be possible to set a
status/ping path like "/~username/status".

Closes GH-4698.
2019-09-17 12:19:21 +02:00
Nikita Popov
fa07a9c223 Fix symtable_cache_limit assignment in phpdbg
The meaning of the limit changed in 7.4, it now points one past the
end. Adjust code accordingly.
2019-09-14 00:25:07 +02:00
Dmitry Stogov
eef85229d0 Link executable files using non PIC object files. This reduces PIC overhead and improves performance. 2019-09-07 11:59:11 +03:00
Nikita Popov
9ec61e43d4 Fix pipe detection and stream position handling
There are two related changes here:
1. Also check for S_ISCHR/FILE_TYPE_CHAR when checking for pipes, so
   that we detect ttys as well, which are also not seekable.
2. Always set position=-1 (i.e. ftell will return false) when a pipe
   is detected. Previously position=0 was sometimes used, depending on
   whether we're on Windows/Linux and whether the FD or FILE codepath
   was used.
2019-09-05 18:29:15 +02:00
Nikita Popov
b4088ba509 Avoid accessing undefined index in CLI server test 2019-08-30 11:02:30 +02:00
Nikita Popov
226fd52c76 Don't call Reflection::export() in --rf etc implementation
This method is deprecated ... instead simply directly print the
object.
2019-08-30 11:02:28 +02:00
Jakub Zelenka
302a1400f3 Merge branch 'PHP-7.3' into PHP-7.4 2019-08-26 18:11:04 +01:00
Tsuyoshi Sadakata
ffcf57fa18 Fix bug #78334 (fpm log prefix message includes wrong stdout/stderr notation) 2019-08-26 18:05:11 +01:00
Nikita Popov
7910f128e2 Fix noalias violation in select call 2019-08-23 16:18:59 +02:00
Nikita Popov
0ed6c37140 Fix FPM timer event re-registration
Make sure that fpm_event_add calls inside a timer callback work by
unregistering the event from the queue before invoking its callback.

The read timeout in tester.inc is increased because the added test
needs two seconds (one for SIGTERM, one for SIGKILL) until the
reload succeeds, so we should wait longer than that for a response.
2019-07-30 10:16:57 +02:00
Peter Kokot
a3169964c0 Remove AC_FPM_POLL
AC_FPM_POLL defines HAVE_POLL symbol which is already checked by
configure.ac and function poll in AC_CHECK_FUNCTIONS.

Closes GH-4449
2019-07-24 22:03:47 +02:00
David Carlier
b05f364333 Fix bindpath mem leak in cgi
Closes GH-4451.
2019-07-24 12:06:40 +02:00
Nikita Popov
d9680272c7 Revert "Drop free_filename field from zend_file_handle"
This reverts commit e0eca26285.

free_filename is used by the wincache extension, restore this
field for PHP 7.4.
2019-07-24 10:43:37 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Nikita Popov
72b9105d30 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 12:41:15 +02:00
Nikita Popov
b59a9381b9 Remove test for bug #77185
Seems to be very unreliable in CI.
2019-07-22 12:40:26 +02:00
Nikita Popov
b2915fc332 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 11:19:24 +02:00
Nikita Popov
5e4dbce586 Reduce number of workers in test
4 seems to be enough to reliably reproduce the issue. Let's see
if this works better in CI.
2019-07-22 11:18:38 +02:00
Nikita Popov
97b80bd83b Merge branch 'PHP-7.3' into PHP-7.4 2019-07-22 10:34:32 +02:00
Maksim Nikulin
bdf24f8d6d Prevent use after free in fpm_event_epoll_wait
epoll event backend does not guarantee that child input/output events
are reported before SIGCHILD due to finished worker. While a bunch of
events received by epoll is being processed, child-related structures
may be removed before dispatching of an I/O event for the same child.
The result may be attempt to access to memory region allocated for
another purpose, segfault of the master process, and unavailable web
sites.

Postpone processing of SIGCHILD events till other events in the same
bunch are processed.

Fix Bug #62418 php-fpm master process crashes
Fix Bug #65398 Race condition between SIGCHLD and child stdout/stderr event leads to segfault
Fix Bug #75112 php-fpm crashing, hard to reproduce
Fix Bug #77114 php-fpm master segfaults in fpm_event_epoll_wait/fpm_event_fire
Fix Bug #77185 Use-after-free in FPM master event handling
2019-07-22 10:32:58 +02:00
George Wang
30de357fa1 Merge branch 'PHP-7.3' into PHP-7.4 2019-07-21 00:01:39 -04:00
George Wang
82f35ab089 Merge branch 'PHP-7.2' into PHP-7.3 2019-07-21 00:01:06 -04:00
George Wang
eb7e45f662 Checked in LiteSpeed SAPI 7.5, addressed two main problems in "clean shutdown" introduced in 7.4.3,
1. falls in an infinite loop because PHP engine's inconsistent state, now override the ITIMER_PROF to 0.1 second, clean shutdown must finish before that.
2. generate too much error log, we completely disable "error_reporting" before calling php_request_shutdown().
2019-07-20 23:59:43 -04:00
rjhdby
d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Peter Kokot
bbdbc2658c Remove duplicate socklen_t check
- Use Autoconf's default AC_CHECK_TYPES

Closes GH-4418
2019-07-18 12:11:19 +02:00
Nikita Popov
a986e70991 Avoid double buffering in Zend streams
Disable buffering in PHP streams, to avoid storing and copying the
file contents twice.

This will call stream_set_option() on custom stream wrapper as
well, so the method needs to be implemented to avoid a warning.
2019-07-17 10:40:04 +02:00
Nikita Popov
b317f0eb59 Remove ZEND_HANDLE_MAPPED
The buf/len members are now simply used in addition to the main
stream, without changing the handle kind.
2019-07-16 17:44:32 +02:00