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: cmb@php.net 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] cmb@php.net
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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-05 09:34 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-05-05 09:35 UTC] cmb@php.net
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] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
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] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC