[php-src] PR #25741: sysvshm: Fix overflow after a writer is killed

From: Date: Wed, 25 Nov 2026 14:57:44 +0000
Subject: [php-src] PR #25741: sysvshm: Fix overflow after a writer is killed
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41000@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25741 Author: dunglas While I was working on the removal of Zend Signals (https://github.com/php/php-src/pull/25627), @bukka found an atomicity problem with interned strings. I looked for similar patterns in the code base. shm_put_var() advanced the end of the data before shrinking the free space, and removing a variable grew the free space before moving the end back. A process killed between the two stores, by SIGKILL or the OOM killer, left a segment whose free space overstated what was left. The segment outlives the process, so later shm_put_var() calls wrote past its end. This is independent of Zend Signals: sysvshm never blocked interruptions, and SIGKILL can't be deferred. This PR orders the stores so that the free space never exceeds what is left. It also stops the lookup at the first chunk whose size or length doesn't fit in the used area, because a writer killed during a removal leaves stale bytes after the moved variables, and the lookup trusted the sizes it read there. Reproduced on PHP-8.4 with gdb by sending SIGKILL between the two stores; the new test covers the lookup with a chunk corrupted through shmop.

« previous php.git-pulls (#41000) next »