Commit graph

1378 commits

Author SHA1 Message Date
txuna
48b492269b
Fix GH-18595: fpm_get_status segfault
This fixes null dereference error when calling fpm_get_status() and one
of the children is just being created.

Closes GH-18662

Co-authored-by: Jakub Zelenka <bukka@php.net>
2025-05-30 22:55:53 +02:00
Arnaud Le Blanc
c531f3d79b
Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM
This fixes a ZEND_RC_MOD_CHECK() assertion failure when building with
"-DZEND_RC_DEBUG=1 --enable-debug --enable-zts". php_dl() is called after
startup, and manipulates the refcount of persistent strings, which is not
allowed at this point of the lifecycle.

The dl() function disables the ZEND_RC_MOD_CHECK() assertion before calling
php_dl(). This change applies the same workaround in FPM.

Closes GH-18075
2025-03-17 17:40:05 +01:00
Jakub Zelenka
e48ceb0026
Fix GH-17643: FPM with httpd ProxyPass encoded PATH_INFO env
Closes GH-17644
2025-02-08 12:05:25 +01:00
Niels Dossche
847d1401a0
Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
The reason this breaks is because of a type mismatch.
The following line uses fields of the timeval struct which are both 8 bytes on
Alpine 32-bit, which results in a computed value of also 8 bytes:
b09ed9a0f2/sapi/fpm/fpm/fpm_status.c (L611)

However, it is passed to a format string which expects 4 bytes
(`unsigned long` and thus the `%lu` format specifier is 4 bytes on Alpine 32-bit),
resulting in argument corruption.
Since the value is generally small, truncating to 4 bytes is sufficient to fix this.

Closes GH-17286.
2024-12-27 21:48:15 +01:00
Christoph M. Becker
fcbfd5a680
Include relevant system headers before defining fallbacks
Otherwise we may define the fallbacks, and later inclusion of the
system headers may attempt to redefine those.

Fixes GH-17112.
Closes GH-17129.
2024-12-22 16:27:01 +01:00
Jakub Zelenka
e0b79cdc5c
Introduce FPM_TEST_DEBUG_FILTER env var and extend multi request tracing 2024-12-22 14:15:03 +01:00
Jakub Zelenka
3490ac0cb3
Fix GH-13437: FPM: ERROR: scoreboard: failed to lock (already locked)
This changes locking for scoreboard to reduce contention between readers
and adds retries for acquiring scoreboard for read.

Closes GH-15805
2024-12-14 14:59:56 +01:00
Jakub Zelenka
af8ebb12ca
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-08 16:48:25 +01:00
Jakub Zelenka
065bde1e13
Fix GH-16432: PHP-FPM 8.2 SIGSEGV in fpm_get_status 2024-11-08 16:44:05 +01:00
Niels Dossche
9a255b384f
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix test with shared zend_test (#16705)
2024-11-05 21:36:41 +01:00
Niels Dossche
3f1ea1b663
Fix test with shared zend_test (#16705) 2024-11-05 21:35:47 +01:00
Niels Dossche
16cda10650
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16628: FPM logs are getting corrupted with this log statement
  Fix GH-16601: Memory leak in Reflection constructors
2024-11-02 19:37:28 +01:00
Niels Dossche
e643129bbb
Fix GH-16628: FPM logs are getting corrupted with this log statement
zlog_buf_prefix() can return a larger length than what actually was
written due to its use of snprintf(). The code in
zlog_stream_prefix_ex() does not take this into account, other callers
do. What ends up happening then is that stream->length is set to the
length as if snprintf() was able to write all bytes, causing
stream->length to become larger than stream->buf.size, causing a
segfault.

In case the buffer was too small we try with a larger buffer up to a
limit of zlog_limit. This makes sure that the stream length will remain
bounded by the buffer size.

This also adds assertions to make the programmer intent clear and catch
this more easily in debug builds.

Closes GH-16680.
2024-11-02 19:36:20 +01:00
Jakub Zelenka
59816b9a73
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-06 19:40:24 +01:00
Jakub Zelenka
5a47f27021
Fix GH-15395: php-fpm: zend_mm_heap corrupted with cgi-fcgi request
Closes GH-16227

Co-authored-by: David Carlier <devnexen@gmail.com>
2024-10-06 19:37:55 +01:00
Ben Ramsey
6d99ccc268
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-26 14:13:00 -05:00
Ben Ramsey
c259c9f3f6
Merge branch 'PHP-8.1' into PHP-8.2 2024-09-26 13:13:46 -05:00
Jakub Zelenka
4580b8b3e1
Fix GHSA-865w-9rf3-2wh5: FPM: Logs from childrens may be altered 2024-09-23 11:24:35 +01:00
Jakub Zelenka
ea79560190
Merge branch 'PHP-8.2' into PHP-8.3 2024-06-16 12:23:15 +01:00
Wilhansen Li
43bc53a730
Fix GH-14037: Make /ping of php-fpm work with pm.status_listen pool
The ping feature of php-fpm monitoring was previously not working
in pm.status_listen pool due to the configuration variables ping.path
and ping.response not being copied over to the worker when forked. This
results in the ping code path being disabled because the worker detects
that ping.path is not configured.

Closes GH-13980

Co-authored-by: Pierrick Charron <pierrick@php.net>
2024-06-16 12:22:21 +01:00
Jakub Zelenka
7f8ffbc813
Merge branch 'PHP-8.2' into PHP-8.3 2024-05-12 13:32:56 +01:00
Benjamin Cremer
5b6cda6523
Fix GH-14175: Use two digit float specifier for FPM systemd format req rate
Close GH-14175
2024-05-12 13:30:29 +01:00
Jakub Zelenka
1b585d2620
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-30 14:38:19 +00:00
Jakub Zelenka
9b1d2e93b8
Fix FPM tester default env vars change
This broke cloexec test
2024-03-30 14:37:54 +00:00
Jakub Zelenka
8edd621501
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-28 15:45:45 +00:00
Jakub Zelenka
d0a8d41eee
Fix GH-13563: Setting bool values via env in FPM config fails
Closes GH-13786
2024-03-28 15:43:50 +00:00
Niels Dossche
81ae6064ce Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix incorrect check in fpm_shm_free() (#13797)
2024-03-24 13:58:41 +01:00
Niels Dossche
dd3aa18545
Fix incorrect check in fpm_shm_free() (#13797)
`if (fpm_shm_size - size > 0)` will be rewritten by the compiler as this: `if (fpm_shm_size != size)`, which is undesirable. The reason this happens is that both variables are size_t, so subtracting them cannot be negative. The only way it can be not > 0, is if they're equal because the result will then be 0. This means that the else branch won't work properly. E.g. if `fpm_shm_size == 50` and `size == 51`, then `fpm_shm_size` will wraparound instead of becoming zero.

To showcase that the compiler actually does this, take a look at this
isolated case: https://godbolt.org/z/azobdWcrY. Here we can see the
usage of the compare instruction + cmove, so the "then" branch
is only done if the variables are equal.
2024-03-24 13:57:08 +01:00
David Carlier
868257a3de Fix GH-13727: macro generating invalid call test prototypes fixes.
autoconf/libtool generating code to test features missed `void` for
C calls prototypes w/o arguments.
Note that specific changes related to libtool have to be upstreamed.

Co-authored-by: Peter Kokot <petk@php.net>

close GH-13732
2024-03-18 06:53:39 +00:00
Jakub Zelenka
a19267d488
Fix GH-11086: FPM: config test runs twice in daemonised mode
The previous check for STDERR did not work so this fixes it.

Closes GH-13357
2024-03-09 09:41:59 +00:00
Jakub Zelenka
ae44ab47a7
Merge branch 'PHP-8.2' into PHP-8.3 2024-02-04 12:00:36 +00:00
Jakub Zelenka
bc30ae4f04
Fix bug #75712: getenv in php-fpm should not read $_ENV, $_SERVER
Closes GH-13195
2024-02-04 11:58:18 +00:00
Jakub Zelenka
1c7dc0f300
Merge branch 'PHP-8.2' into PHP-8.3 2024-01-11 16:48:03 +00:00
Jakub Zelenka
b04b09ef56
Fix GH-12996: Incorrect SCRIPT_NAME with Apache ProxyPassMatch when plus in path
Closes GH-13072
2024-01-11 16:47:08 +00:00
Peter Kokot
04954f6b2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Set libtool tag per command instead of global one
2024-01-10 09:13:39 +01:00
Jan Palus
d57a7767a2 Set libtool tag per command instead of global one
Global --tag=CC defined in configure.ac is not correct in all cases. For example
linking objects that were compiled from C++ sources needs to be done with C++
compiler, however for link mode libtool will prefer compiler indicated with
--tag.

Fixes GH-12349
2024-01-10 09:09:45 +01:00
Peter Kokot
bafb17adcf Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update year to 2024
2024-01-04 19:29:37 +01:00
Peter Kokot
2575e6b88c Update year to 2024 2024-01-04 19:26:32 +01:00
Jakub Zelenka
43900bd568
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-09 13:26:09 +00:00
Jakub Zelenka
62682cbd97
Add FPM tester logs printing for all errors
Closes GH-12902
2023-12-09 13:21:41 +00:00
Jakub Zelenka
c74fc4c5b0
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-01 14:47:57 +00:00
Jakub Zelenka
2303e76740
Merge branch 'PHP-8.1' into PHP-8.2 2023-12-01 14:45:48 +00:00
Patrick Prasse
df259f88da
Fix bug GH-12705: Segmentation fault in fpm_status_export_to_zval
Closes GH-12706
2023-12-01 14:43:58 +00:00
Niels Dossche
e1c6a7c4de
Fix GH-12621: browscap segmentation fault when configured in the vhost
The temporary HashTable has a destructor that releases the string held
by the entry's value. However, browscap_intern_str(_ci) only incremented
the refcount for the reference created by the return value. As the
HashTable is only used during parsing, we don't need to manage the
reference count of the value anyway, so get rid of the destructor.

This is triggerable in two cases:
 - When using php_admin_value to set the ini at the activation stage
 - When running out of space for the opcache-interned strings

Closes GH-12634.
2023-11-22 20:39:28 -06:00
Niels Dossche
1fb73463d3 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12621: browscap segmentation fault when configured in the vhost
2023-11-11 18:36:32 +01:00
Niels Dossche
7353c7ce17 Fix GH-12621: browscap segmentation fault when configured in the vhost
The temporary HashTable has a destructor that releases the string held
by the entry's value. However, browscap_intern_str(_ci) only incremented
the refcount for the reference created by the return value. As the
HashTable is only used during parsing, we don't need to manage the
reference count of the value anyway, so get rid of the destructor.

This is triggerable in two cases:
 - When using php_admin_value to set the ini at the activation stage
 - When running out of space for the opcache-interned strings

Closes GH-12634.
2023-11-11 18:35:57 +01:00
Jakub Zelenka
d02a8f4e87
Separate setting of SO_KEEPALIVE in FPM tests
Closes GH-12640
2023-11-10 09:45:19 +00:00
Jakub Zelenka
52b13f6ddb
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-03 17:17:52 +00:00
Jakub Zelenka
882cc4f804
Merge branch 'PHP-8.1' into PHP-8.2 2023-11-03 17:17:23 +00:00
Jakub Zelenka
a8c6c6165b
Fix GH-9921: Loading ext in FPM config does not register module handlers
Closes GH-12377
2023-11-03 16:53:09 +00:00