Commit graph

5919 commits

Author SHA1 Message Date
Jakub Zelenka
0b4f2fc9e8
Merge branch 'PHP-8.1' into PHP-8.2 2023-04-07 12:29:23 +01:00
Jakub Zelenka
ebb3213f79
Add FPM FCGI env Apache handler UDS test 2023-04-07 12:28:42 +01:00
Jakub Zelenka
1ca1858f31
Merge branch 'PHP-8.1' into PHP-8.2 2023-04-06 16:00:48 +01:00
Jakub Zelenka
15802dfc62 Add FPM FastCGI env var test for Apache without path info fix 2023-04-06 15:59:34 +01:00
Ilija Tovilo
9b15537e9a
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Unparallelize IO heavy tests
2023-03-27 16:34:11 +02:00
Ilija Tovilo
e1ec67acd6
Unparallelize IO heavy tests
Alternative to GH-10892. This is somewhat unfortunate since these are also the
slow tests. I'm also not sure if this actually helps.

Closes GH-10953
2023-03-27 16:33:36 +02:00
Jakub Zelenka
2b0d29bf17
Merge branch 'PHP-8.1' into PHP-8.2 2023-03-19 13:17:09 +00:00
Jakub Zelenka
0d4d471847
Fix bug #74129: Incorrect SCRIPT_NAME with apache ProxyPassMatch
This happens when there are spaces are in the path info. The reason is
that Apache decodes the path info part in the SCRIPT_NAME as per CGI
RFC. FPM tries to strip path info from the SCRIPT_NAME but the
comparison is done against SCRIPT_FILENAME which is not decoded. For
that to work we have to decode it before comparison if there is any
encoded character.

Closes GH-10869
2023-03-19 13:11:14 +00:00
Niels Dossche
e44b1a916d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Destroy file_handle in fpm_main
2023-03-18 21:00:21 +01:00
Niels Dossche
f30e71cbde Destroy file_handle in fpm_main
If it's not in the CG(open_files) list, we need to destroy the file
handle ourselves.

Co-authored-by: Jakub Zelenka <bukka@php.net>

Closes GH-10707.
2023-03-18 20:54:46 +01:00
Jakub Zelenka
4ac12006ae
Merge branch 'PHP-8.1' into PHP-8.2 2023-03-17 14:56:45 +00:00
Jakub Zelenka
7d987ebbbf Fix FPM tester $scriptName logic 2023-03-17 14:55:51 +00:00
Jakub Zelenka
e9bbddcdaf
Merge branch 'PHP-8.1' into PHP-8.2 2023-03-17 10:45:14 +00:00
Jakub Zelenka
38d2e7ea9a
Test FPM FCGI envs with path info fix for Apache proxy pass 2023-03-17 10:42:16 +00:00
Jakub Zelenka
8cf621e0e4
Test FPM FCGI envs with path info fix for Apache proxy handler 2023-03-17 10:42:16 +00:00
Jakub Zelenka
b53b0ac2ea
Test FPM FCGI envs with path info fix for Apache proxy balancer 2023-03-17 10:42:15 +00:00
Jakub Zelenka
92d2cd5cb8
Test FPM FCGI envs without path info fix for custom source 2023-03-17 10:42:15 +00:00
Jakub Zelenka
3125155b5d
Add extra option to FPM tester for handling script filename 2023-03-17 10:42:14 +00:00
Ilija Tovilo
70c29f84b1
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Skip upload_2G.phpt on Cirrus
2023-03-15 02:11:49 +01:00
Ilija Tovilo
84e7d4a3c8
[skip ci] Skip upload_2G.phpt on Cirrus 2023-03-15 02:11:11 +01:00
Niels Dossche
6a44705f4e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10611: fpm_env_init_main leaks environ
2023-03-11 16:35:11 +01:00
Niels Dossche
71c63723c8 Fix GH-10611: fpm_env_init_main leaks environ
Closes GH-10618.
2023-03-11 16:34:41 +01:00
Ilija Tovilo
f415ba60ab
Disable asan instrumentation for phpdbg_watchpoint_userfaultfd_thread
On gcc. It reports a false positive stack-overflow.

Closes GH-10818
2023-03-10 00:13:27 +01:00
Niels Dossche
7682868dd1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
  Fix GH-8646: Memory leak PHP FPM 8.1
2023-03-07 20:26:57 +01:00
Niels Dossche
ff62d117a3 Fix GH-8646: Memory leak PHP FPM 8.1
Fixes GH-8646
See https://github.com/php/php-src/issues/8646 for thorough discussion.

Interned strings that hold class entries can get a corresponding slot in map_ptr for the CE cache.
map_ptr works like a bump allocator: there is a counter which increases to allocate the next slot in the map.

For class name strings in non-opcache we have:
  - on startup: permanent + interned
  - on request: interned
For class name strings in opcache we have:
  - on startup: permanent + interned
  - on request: either not interned at all, which we can ignore because they won't get a CE cache entry
                or they were already permanent + interned
                or we get a new permanent + interned string in the opcache persistence code

Notice that the map_ptr layout always has the permanent strings first, and the request strings after.
In non-opcache, a request string may get a slot in map_ptr, and that interned request string
gets destroyed at the end of the request. The corresponding map_ptr slot can thereafter never be used again.
This causes map_ptr to keep reallocating to larger and larger sizes.

We solve it as follows:
We can check whether we had any interned request strings, which only happens in non-opcache.
If we have any, we reset map_ptr to the last permanent string.
We can't lose any permanent strings because of map_ptr's layout.

Closes GH-10783.
2023-03-07 20:16:17 +01:00
David Carlier
4c2db35b05 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-27 19:48:13 +00:00
Niels Dossche
0f21cbc57c Fix GH-10715: phpdbg heap buffer overflow -- by misuse of the option "--run"
Fixes GH-10715

When a string starting with a NUL character is passed to
phpdbg_vprint(), the vasprintf() will return that 0 characters have been
printed. This causes msglen == 0. When phpdbg_process_print() is called
with a message of length 0, the -1 to check for '\n' will perform an out
of bounds read. Since nothing is printed anyway for msglen == 0, it
seems best to just skip the printing routine for this case.

Closes GH-10720.
2023-02-27 19:47:55 +00:00
Remi Collet
73b3f78ea0
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  more config for new FPM tests
2023-02-14 14:14:34 +01:00
Remi Collet
b11d855dbf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  more config for new FPM tests
2023-02-14 14:14:03 +01:00
Remi Collet
e86d8704b4
more config for new FPM tests 2023-02-14 14:13:40 +01:00
Jakub Zelenka
cbf089018b
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-14 11:00:20 +00:00
Jakub Zelenka
4058d20608
Merge branch 'PHP-8.0' into PHP-8.1 2023-02-14 10:52:17 +00:00
Jakub Zelenka
716de0cff5
Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-14 10:21:23 +00:00
David Carlier
81aedad452 opcache/pcntl/cli: Fixes few functions signatures. 2023-02-09 19:57:48 +00:00
Jakub Zelenka
2b71fa6952
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 13:10:19 +00:00
Niels Dossche
5b13e83074
Fix GH-10385: FPM successful config test early exit
This introduces an enum `fpm_init_return_status` to propagate the status
up to fpm_main. This also makes the code clearer by not using magic
integer return numbers.

Closes GH-10388
2023-02-05 13:07:29 +00:00
Jakub Zelenka
aa9b5ed1e4
Merge branch 'PHP-8.1' into PHP-8.2 2023-02-05 12:37:40 +00:00
Jakub Zelenka
4199b72c50
Fix GH-10315: FPM unknown child alert not valid
This changes the log level for an unknown child during wait as this is
not unuasual if FPM master has pid 1 and also possible in some cases
for higher pid processes. Based on that and the fact that this is not
really a problem, there is just a debug level message emitted for pid 1
and for higher pid a warning is emitted.

Closes GH-10319
2023-02-05 12:36:02 +00:00
George Peter Banyard
dd5c5ca7a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle exceptions from __toString in XXH3's initialization
  Fix phpdbg segmentation fault in case of malformed input
2023-01-17 14:16:18 +00:00
Niels Dossche
398a10a58a
Fix phpdbg segmentation fault in case of malformed input
If you were to enter "w $>" the function would crash with a segmentation
fault because last_index is still NULL at that point. Fix it by checking
for NULL and erroring out if it is.

Closes GH-10353

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:12:49 +00:00
Jakub Zelenka
d0dd77a3c2
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-14 15:14:44 +00:00
Jakub Zelenka
7d98e3e40c
Fix missing comment in FPM www.conf.in 2023-01-14 15:13:55 +00:00
Jakub Zelenka
a8c387e89c
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-13 10:32:52 +00:00
Jakub Zelenka
120aafcc42
Fix bug #67244: Wrong owner:group for listening unix socket
Update FPM www.conf to reflect the actual logic
2023-01-13 10:31:01 +00:00
Jakub Zelenka
1b48a5c802
Fix ASAN reported leak in FPM config test
This happens because config test does not shutdown SAPI.

In addition this commit also fixes few failures when running FPM tests
under root.

Closes GH-10296
2023-01-12 13:52:33 +00:00
George Peter Banyard
e308dc0635 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10251: Assertion `(flag & (1<<3)) == 0' failed.
  Fix GH-9710: phpdbg memory leaks by option "-h"
2023-01-08 16:11:46 +00:00
Niels Dossche
8ff2b6abb2 Fix GH-9710: phpdbg memory leaks by option "-h"
Closes GH-10237

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-08 16:07:00 +00:00
David Carlier
9faa3f1695 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-30 06:53:44 +00:00
Niels Dossche
3a44c78f14 Fix null pointer dereference of param
When the validation logic for param->type was added, the logic did not
account for the case where param could be NULL. The existing code did
take that into account as can be seen in the `if (param)` check below.
Furthermore, phpdbg_set_breakpoint_expression even calls
phpdbg_create_conditional_break with param == NULL.

Fix it by placing the validation logic inside a NULL check.
2022-12-30 06:53:28 +00:00
Jakub Zelenka
21d8980d27
Fix bug #68591: Configuration test does not perform UID lookups
Addition check in fpm config test to verify existence of user, group,
listen.owner and listen.group.

Closes GH-10165
2022-12-26 14:14:14 +00:00