com php-src: Fix #66908: php-fpm reload leaks epoll_create( ) file descriptor: NEWS sapi/fpm/fpm/events/epoll .c
| From: | Stanislav Malyshev | Date: | Sun, 20 Apr 2014 23:21:49 +0000 |
| Subject: | com php-src: Fix #66908: php-fpm reload leaks epoll_create( ) file descriptor: NEWS sapi/fpm/fpm/events/epoll .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76955@lists.php.net to get a copy of this message | ||
Commit: 49341e992ad7f8eb7f94d4c946fb74f8e33e7e75
Author: Julio Pintos <julio.pintos@avature.net> Fri, 14 Mar 2014 16:47:30 -0300
Committer: Stanislav Malyshev <stas@php.net> Sun, 20 Apr 2014 16:21:49 -0700
Parents: a18cec1b865994735e5b4ab757ccc1a14f8607ff
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src..git;a=commitdiff;h=49341e992ad7f8eb7f94d4c946fb74f8e33e7e75
Log:
Fix #66908: php-fpm reload leaks epoll_create() file descriptor
This patch fixes descriptor leak which could lead to DoS once Max open files is reached
Bugs:
https://bugs.php.net/66908
Changed paths:
M NEWS
M sapi/fpm/fpm/events/epoll.c
Diff:
diff --git a/NEWS b/NEWS
index d9f0f8a..7b2b404 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,10 @@ PHP NEWS
. Fixed bug #67081 (DOMDocumentType->internalSubset returns entire DOCTYPE tag,
not only the subset). (Anatol)
+- FPM:
+ . Fixed bug #66908 (php-fpm reload leaks epoll_create() file descriptor).
+ (Julio Pintos)
+
?? ??? 2014, PHP 5.4.28
- Core:
diff --git a/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c
index 2857ea2..b55cb44 100644
--- a/sapi/fpm/fpm/events/epoll.c
+++ b/sapi/fpm/fpm/events/epoll.c
@@ -46,7 +46,7 @@ static struct fpm_event_module_s epoll_module = {
static struct epoll_event *epollfds = NULL;
static int nepollfds = 0;
-static int epollfd = 0;
+static int epollfd = -1;
#endif /* HAVE_EPOLL */
@@ -103,6 +103,10 @@ static int fpm_event_epoll_clean() /* {{{ */
free(epollfds);
epollfds = NULL;
}
+ if (epollfd != -1) {
+ close(epollfd);
+ epollfd = -1;
+ }
nepollfds = 0;