File tree Expand file tree Collapse file tree 4 files changed +51
-6
lines changed Expand file tree Collapse file tree 4 files changed +51
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ PHP NEWS
5
5
- Date:
6
6
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
7
7
8
+ - FPM:
9
+ . Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
10
+ non-blocking). (Nikita)
11
+
8
12
22 Jun 2019, PHP 7.1.19
9
13
10
14
- CLI Server:
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ static struct fpm_child_s *fpm_child_find(pid_t pid) /* {{{ */
146
146
static void fpm_child_init (struct fpm_worker_pool_s * wp ) /* {{{ */
147
147
{
148
148
fpm_globals .max_requests = wp -> config -> pm_max_requests ;
149
+ fpm_globals .listening_socket = dup (wp -> listening_socket );
149
150
150
151
if (0 > fpm_stdio_init_child (wp ) ||
151
152
0 > fpm_log_init_child (wp ) ||
Original file line number Diff line number Diff line change @@ -103,12 +103,6 @@ int fpm_stdio_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
103
103
fpm_globals .error_log_fd = -1 ;
104
104
zlog_set_fd (-1 );
105
105
106
- if (wp -> listening_socket != STDIN_FILENO ) {
107
- if (0 > dup2 (wp -> listening_socket , STDIN_FILENO )) {
108
- zlog (ZLOG_SYSERROR , "failed to init child stdio: dup2()" );
109
- return -1 ;
110
- }
111
- }
112
106
return 0 ;
113
107
}
114
108
/* }}} */
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ FPM: bug73342 - Non-blocking stdin
3
+ --SKIPIF--
4
+ <?php include "skipif.inc " ; ?>
5
+ --FILE--
6
+ <?php
7
+
8
+ require_once "tester.inc " ;
9
+
10
+ $ cfg = <<<EOT
11
+ [global]
12
+ error_log = {{FILE:LOG}}
13
+ [unconfined]
14
+ listen = {{ADDR}}
15
+ pm = dynamic
16
+ pm.max_children = 5
17
+ pm.start_servers = 1
18
+ pm.min_spare_servers = 1
19
+ pm.max_spare_servers = 3
20
+ EOT ;
21
+
22
+ $ code = <<<EOT
23
+ <?php
24
+ echo "Before \n";
25
+ stream_set_blocking(fopen('php://stdin', 'r'), false);
26
+ echo "After \n";
27
+ EOT ;
28
+
29
+ $ tester = new FPM \Tester ($ cfg , $ code );
30
+ $ tester ->start ();
31
+ $ tester ->expectLogStartNotices ();
32
+ $ tester ->request ()->expectBody ("Before \nAfter " );
33
+ $ tester ->request ()->expectBody ("Before \nAfter " );
34
+ $ tester ->terminate ();
35
+ $ tester ->expectLogTerminatingNotices ();
36
+ $ tester ->close ();
37
+
38
+ ?>
39
+ Done
40
+ --EXPECT--
41
+ Done
42
+ --CLEAN--
43
+ <?php
44
+ require_once "tester.inc " ;
45
+ FPM \Tester::clean ();
46
+ ?>
You can’t perform that action at this time.
0 commit comments