[php-src] PR #26070: Fixed bug GH-26066: take scoreboard writer lock in fpm_request_end()
| From: | fusionfoto | Date: | Fri, 04 Dec 2026 11:55:12 +0000 |
| Subject: | [php-src] PR #26070: Fixed bug GH-26066: take scoreboard writer lock in fpm_request_end() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41414@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/26070
Author: fusionfoto
Fixes GH-26066.
In PHP 8.6 the FPM scoreboard write path was split into
fpm_scoreboard_update_begin() (acquires writer_active, waits for
reader_count == 0) and fpm_scoreboard_update_commit() (writes the shared
counters, then releases writer_active). Every writer pairs the two calls
(fpm_request.c:45/58, :77/102) except fpm_request_end(),
which called only
commit. Because commit ends by releasing writer_active, this released a writer
lock that was never acquired and updated the shared counters without ensuring
reader_count == 0, so a concurrent ?full status reader could read a torn
scoreboard, with a possible writer-lock imbalance.
This adds the matching fpm_scoreboard_update_begin(NULL) immediately before
the commit (after fpm_scoreboard_proc_release(proc)), so the writer lock is
held across the update. Placing begin right before commit rather than at
function entry avoids leaking the writer lock on the proc == NULL
early-return path.
8.3 is not affected: it has no begin/commit split and uses a single
fpm_scoreboard_update().
Built with --enable-fpm --enable-debug; make test TESTS=sapi/fpm passes
(138 passed, 0 failed, 0 warned, 20 skipped; exit 0). No new test is added: the
defect is a cross-process scoreboard lock-pairing bug with no deterministic
single-process reproducer in the test harness.