[php-src] PR #24042: TSRM: Fix Windows shared memory payload offset
| From: | iliaal | Date: | Thu, 01 Oct 2026 10:55:34 +0000 |
| Subject: | [php-src] PR #24042: TSRM: Fix Windows shared memory payload offset | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39030@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24042
Author: iliaal
On Windows,
shmat() returned shm->descriptor +
sizeof(shm->descriptor), which is pointer arithmetic on a struct shmid_ds pointer, so the
payload began 448 bytes into the view on x64 while shmget() had reserved only 8 bytes for the
56-byte descriptor and reported that inflated size in shm_segsz. A shmop or sysvshm segment whose
end lies near a page boundary therefore faults on write, and shmop_size() over-reports by 8 bytes.
This dates back to d7bdc040b4e (PHP 8.2), which moved the descriptor into the payload mapping. The
payload now starts right after one descriptor, the mapping reserves sizeof(struct shmid_ds), and
shm_segsz holds the requested size.