-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Windows C shmget(IPC_PRIVATE, ...) returns IPC_PRIVATE(0) instead of distinct id for new section #9944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this issue
Nov 13, 2022
Closes php#9944 https://man7.org/linux/man-pages/man2/shmget.2.html notes The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW would more clearly show its function.
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this issue
Nov 13, 2022
Closes php#9944 https://man7.org/linux/man-pages/man2/shmget.2.html notes The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW would more clearly show its function.
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this issue
Nov 13, 2022
Closes php#9944 https://man7.org/linux/man-pages/man2/shmget.2.html notes The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW would more clearly show its function.
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this issue
Nov 13, 2022
Closes php#9944 https://man7.org/linux/man-pages/man2/shmget.2.html notes The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW would more clearly show its function.
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this issue
Nov 13, 2022
Closes php#9944 https://man7.org/linux/man-pages/man2/shmget.2.html notes The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW would more clearly show its function.
cmb69
added a commit
that referenced
this issue
Dec 13, 2022
The recently committed fix for GH-9944 did only indirectly cater to that, namely because in this case `CreateFileMapping()` with a zero size couldn't be created. As of PHP 8.2.0, the mappings of the actual SHM and the info segment have been merged, so creating a zero size SHM would be possible unless we explicitly prohibit this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
https://github.com/php/php-src/blob/php-8.2.0RC6/TSRM/tsrm_win32.c#L613-L683
Resulted in this output because nothing sets
key
for IPC_PRIVATE:But I expected this output instead:
If code calls shmget(IPC_PRIVATE) multiple times on Windows and gets IPC_PRIVATE as a result, applications would need distinct ids to distinguish them in operations managing the shared memory segments
Related to Bug in refactoring in PHP 8.2 Windows shmat() function #9829 - I believe TSRM/tsrm_win32.c for windows didn't attempt to support IPC_PRIVATE in PHP versions prior to that
Noticed while investigating krakjoe/apcu#445 when using more than one shared segment
It seems like it should immediately choose a distinct id if
key == IPC_PRIVATE
- it'd be clobbering the existing entry with the key 0, which would prevent detaching segments other than the most recent one created with IPC_PRIVATEhttps://github.com/php/php-src/blob/php-8.2.0RC6/TSRM/tsrm_win32.c#L652-L657
https://man7.org/linux/man-pages/man2/shmget.2.html
PHP Version
8.2. Possibly goes back to 7.4 for https://bugs.php.net/bug.php?id=79566 ?
Operating System
Windows
The text was updated successfully, but these errors were encountered: