|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66623 no EINTR check on flock(LOCK_EX)
Submitted: 2014-02-01 08:48 UTC Modified: 2014-12-10 22:49 UTC
From: php at bof dot de Assigned: yohgaki (profile)
Status: Closed Package: Session related
PHP Version: 5.6.0alpha1 OS:
Private report: No CVE-ID: None
 [2014-02-01 08:48 UTC] php at bof dot de
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-01 22:24 UTC]
-Assigned To: +Assigned To: yohgaki
 [2014-02-01 22:28 UTC]
Thank you for reporting.
 [2014-10-17 13:59 UTC]
any update on this?
 [2014-12-10 22:49 UTC]
I'll process my list of todos before PHP7, hopefully.
 [2015-02-03 05:08 UTC]
Automatic comment on behalf of yohgaki
Log: Fixed Bug #66623 no EINTR check on flock(LOCK_EX)
 [2015-02-03 05:08 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 00:01:35 2024 UTC