Bug #66623 [NEW]: no EINTR check on flock(LOCK_EX)

From: Date: Sat, 01 Feb 2014 08:48:22 +0000
Subject: Bug #66623 [NEW]: no EINTR check on flock(LOCK_EX)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184112@lists.php.net to get a copy of this message
From:             php at bof dot de
Operating system: 
PHP version:      5.6.0alpha1
Package:          Session related
Bug Type:         Bug
Bug description:no EINTR check on flock(LOCK_EX)

Description:
------------
Noticed a problem in ext/session/mod_files.c :

> Some syscalls can fail with EINTR, when a signal hits while within
the
> kernel. This is especially true for flock(LOCK_EX) because in the
> already-locked case the second call will go to sleep for a while
waiting
> for the lock to clear. But it is also possible, I think, for the
> pread/read/write calls. The usual handling for the case (-1 return &&
> errno
> == EINTR) is to just repeat the call in a while loop. I think that at
> least
> doing so for the LOCK_EX calls, would be prudent.

Re-Read the manpage (*) a bit... read/pread/write should be safe here,
going 
to disk, and not a pipe or socket. But flock() will return EINTR when 
signalled and the signal handler did not use SA_RESTART. Most PHP
execution 
will _probably_ okay anyway as $restart_syscalls is default true for 
pcntl_signal(), but handling would be safer anyway.



-- 
Edit bug report at https://bugs.php.net/bug.php?id=66623&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66623&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66623&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66623&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66623&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66623&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66623&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66623&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66623&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66623&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66623&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66623&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66623&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66623&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66623&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66623&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66623&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66623&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66623&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66623&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66623&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#184112) next »