#40760 [NEW]: not honoring mode of shm_attach
| From: | secker at careviewcom dot com | Date: | Thu, 08 Mar 2007 17:41:31 +0000 |
| Subject: | #40760 [NEW]: not honoring mode of shm_attach | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-110097@lists.php.net to get a copy of this message | ||
From: secker at careviewcom dot com
Operating system: Debian 'Etch', kern 2.6.17-2-486
PHP version: 5.2.1
PHP Bug Type: Unknown/Other Function
Bug description: not honoring mode of shm_attach
Description:
------------
If I create a Shared memory segment using shm_attach with one user, and
set it as readable by all users, but only writable by the owner, then
other users cannot open the segment via shm_attach, they get permission
denied errors.
I would guess this is maybe because shm_attach can't open a segment as
read-only, and always tried to open it as rw?
Reproduce code:
---------------
run as someuser1:
<?php
$f = ftok('somefile', 'I');
$sh = shm_attach($f, 1024000, 0644);
?>
works if its not already created by another user...
run as someuser2:
<?php
$f = ftok('somefile', 'I');
$sh = shm_attach($f);
?>
Expected result:
----------------
what I would expect is that since I created it as 0644, other users should
be able to access it via read-only mode (which I can do if I open it using
shmop_open with the read-only flag instead).
Actual result:
--------------
second user gets "Permission Denied" php warning messages.
once again, I think this is mearly a result of shm_attach not actually
ever opening an shm as read-only, always read-write... but I might be
mistaken.
Thanks.
--
Edit bug report at http://bugs.php.net/?id=40760&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40760&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40760&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40760&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40760&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40760&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40760&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40760&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40760&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40760&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40760&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40760&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40760&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40760&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40760&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40760&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40760&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40760&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40760&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40760&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40760&r=mysqlcfg