[php-src] PR #16765: [wip] Refresh zend mm shadow key on fork
| From: | arnaud-lb | Date: | Tue, 12 Nov 2024 17:34:46 +0000 |
| Subject: | [php-src] PR #16765: [wip] Refresh zend mm shadow key on fork | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29609@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/16765
Author: arnaud-lb
The memory manager is cleaned up after each request by calling
shutdown_memory_manager(). At the same time, this prepares the manager for the next
request, and the shadow key is refreshed.
Unfortunately, the first request of every child process inherits the memory manager of the parent
process, including the shadow key. As a result, a leak of the shadow key during the first request of
one process gives away the shadow key used during the first request of other processes.
Here I ensure that we refresh the shadow key after a fork. The memory manager is not empty at this
point (we perform allocation after shutdown_memory_manager()), so we have to recompute
any shadow pointers with the new key.
I'm targeting 8.4, but this is too risky and not critical enough for the last RC. I would like
to merge this in 8.4.1.