[php-src] PHP-8.5: fpm: fix a use-after-free of scoreboard_p
| From: | Marcel Hernandez via Jakub Zelenka | Date: | Tue, 27 Oct 2026 17:53:59 +0000 |
| Subject: | [php-src] PHP-8.5: fpm: fix a use-after-free of scoreboard_p | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142837@lists.php.net to get a copy of this message | ||
Author: Marcel Hernandez (1ma)
Committer: Jakub Zelenka (bukka)
Date: 2026-10-27T18:49:55+01:00
Commit: https://github.com/php/php-src/commit/3aa4da4a20707d81aa2a849177587595c8a8ac7a
Raw diff: https://github.com/php/php-src/commit/3aa4da4a20707d81aa2a849177587595c8a8ac7a.diff
fpm: fix a use-after-free of scoreboard_p
Changed paths:
M NEWS
M sapi/fpm/fpm/fpm_status.c
Diff:
diff --git a/NEWS b/NEWS
index 1e7e1e152e20..f1d8974b0bfc 100644
--- a/NEWS
+++ b/NEWS
@@ -78,6 +78,8 @@ PHP NEWS
. Fixed bug GH-24046 (FPM worker stdio pipe fd closed twice when a child
process outlives the worker, breaking a later worker's stdio).
(Ian P. Christian, ndossche)
+ . Fixed use-after-free of the scoreboard copy when logging invalid status
+ values. (Marcel Hernandez)
. Fixed null pointer dereference in fpm_get_status() when the scoreboard
copy fails. (Marcel Hernandez)
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index da907a9d1af1..f030bb309ae4 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -187,13 +187,13 @@ int fpm_status_handle_request(void) /* {{{ */
}
if (scoreboard_p->idle < 0 || scoreboard_p->active < 0) {
- fpm_scoreboard_free_copy(scoreboard_p);
zlog(ZLOG_ERROR, "[pool %s] invalid status values", scoreboard_p->pool);
SG(sapi_headers).http_response_code = 500;
sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1);
sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1);
sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate,
max-age=0"), 1, 1);
PUTS("Internal error. Please review log file for errors.");
+ fpm_scoreboard_free_copy(scoreboard_p);
return 1;
}