Ask a Question related to PHP Bugs, Design and Development.
-
secker at careviewcom dot com #1
#40760 [NEW]: not honoring mode of shm_attach
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 [url]http://bugs.php.net/?id=40760&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40760&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40760&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40760&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40760&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40760&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40760&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40760&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40760&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40760&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40760&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40760&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40760&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40760&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40760&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40760&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40760&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40760&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40760&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40760&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40760&r=mysqlcfg[/url]
secker at careviewcom dot com Guest
-
#39289 [NEW]: all right in CGI/FastCGI mode, but not right in ISAPI mode.
From: bin at tbswe dot com Operating system: Windows 2003 PHP version: 5.1.6 PHP Bug Type: Dynamic loading Bug description: ... -
Difference b/w Flex Mode and Classic Mode
Hi can anyone explain the difference b/w Flex Mode and Classic mode of serialization tag in gateway-config.xml .? what is the purpose of ... -
PAR executables not honoring perl5opt
I just installed PAR 0.81 on my ActivePerl 5.6.1 for Win32 (build 629). When I use pp to create an executable, everything works fine if I don't... -
Normal Mode and Expert Mode in MX2004
In this case I think the appalling way MM is treating us WAY trumps any "netiquette" issues. In fact, I think more people should be posting the... -
PHP and I-mode
Does somebody know if PHP works in I-mode pages? Thanks -
tony2001@php.net #2
#40760 [Opn->Bgs]: not honoring mode of shm_attach
ID: 40760
Updated by: [email]tony2001@php.net[/email]
Reported By: secker at careviewcom dot com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Debian 'Etch', kern 2.6.17-2-486
PHP Version: 5.2.1
New Comment:
[url]http://php.net/shm_attach[/url]>$sh = shm_attach($f);
"..and the optional perm-bits perm (default: 0666)..."
Exactly.>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?
That's because by default it tries to open it in 0666 mode.
Specify 0644 and voila..
Previous Comments:
------------------------------------------------------------------------
[2007-03-08 17:41:31] secker at careviewcom dot com
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 this bug report at [url]http://bugs.php.net/?id=40760&edit=1[/url]
tony2001@php.net Guest



Reply With Quote

