#39754 [Asn->Csd]: Some POSIX extension functions not thread safe
| From: | iliaa@php.net | Date: | Thu, 07 Dec 2006 01:41:36 +0000 |
| Subject: | #39754 [Asn->Csd]: Some POSIX extension functions not thread safe | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106046@lists.php.net to get a copy of this message | ||
ID: 39754
Updated by: iliaa@php.net
Reported By: wharmby at uk dot ibm dot com
-Status: Assigned
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: Linux RHEL4
PHP Version: 5CVS-2006-12-06 (snap)
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-12-06 14:26:06] wharmby at uk dot ibm dot com
Description:
------------
The current implementation of the following POSIX extension
functions calls non-reentrant functions as follows:
posix_ttynamee uses ttyname
posix_getpwnam uses getpwnam
posix_getgrnam uses getgrnam
and therefore not thread safe. This will lead to unexpected
behaviour when used in ZTS enabled builds.
In all cases there are re-entrant versions of these functions available
on *nix systems, namely ttyname_r
getpwnam_r and getgrnam_r which should be used instead in order to
ensure thread safety.
The following patch, which was built against the latest snapshot (Dec
6th, 2006, 1130 GMT) modifies the code in
ext/posix/posix.c to use the reentrant versions of these
functions:
http://pastebin.ca/269334
The following patch makes the necessary modification to the
configure.in file to support the above change:
http://pastebin.ca/269335
Andy Wharmby
IBM United Kingdom Limited
Reproduce code:
---------------
Problem found by code inspection. As with most thread safety
issues difficult to produce a simple testcase which will show
a reproducible crash but current Linux executable is clearly not
reentrant as it stands.
Expected result:
----------------
N/A
Actual result:
--------------
N/A
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39754&edit=1