php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79566 Private SHM is not private on Windows
Submitted: 2020-05-05 09:31 UTC Modified: 2020-05-05 09:34 UTC
From: [email protected] Assigned: cmb (profile)
Status: Closed Package: *Extensibility Functions
PHP Version: 7.3Git-2020-05-05 (Git) OS: Windows only
Private report: No CVE-ID: None
 [2020-05-05 09:31 UTC] [email protected]
Description:
------------
Calling shmop_open() with a $key that matches IPC_PRIVATE (which
is usually zero on POSIX, and always zero on Windows), creates
private shared memory on POSIX, but not on Windows.

This is actually not particularly related to ext/shmop, but rather
to our Windows emulation layer for XSI shared memory (shmget() and
friends), so all extensions which use that functionality to create
private SHM are affected by this.  For instance, APCu[1].

[1] <https://github.com/krakjoe/apcu/issues/394>


Test script:
---------------
<?php
$write = 'test';

$shm1 = shmop_open(0, 'c', 0777, 1024);
shmop_write($shm1, $write, 0);

$shm2 = shmop_open(0, 'c', 0777, 1024);
$read = shmop_read($shm2, 0, 4);

var_dump(is_string($read) && $read !== $write);

shmop_close($shm1);
shmop_close($shm2);
?>


Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-05 09:34 UTC] [email protected]
-Assigned To: +Assigned To: cmb
 [2020-05-05 09:35 UTC] [email protected]
The following pull request has been associated:

Patch Name: Support shmget(IPC_PRIVATE, …) on Windows
On GitHub:  https://github.com/php/php-src/pull/5519
Patch:      https://github.com/php/php-src/pull/5519.patch
 [2020-05-05 09:42 UTC] [email protected]
Automatic comment on behalf of [email protected]
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f33cf52faf733f5a6441a533f83e9b1cf2018245
Log: Fix #79566: Private SHM is not private on Windows
 [2020-05-05 09:42 UTC] [email protected]
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jun 08 15:01:26 2025 UTC