This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/5069] env thread safety problem
- From: "zhangxiliang at cn dot fujitsu dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 25 Sep 2007 03:09:26 -0000
- Subject: [Bug libc/5069] env thread safety problem
- References: <20070925030652.5069.zhangxiliang@cn.fujitsu.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From zhangxiliang at cn dot fujitsu dot com 2007-09-25 03:09 -------
Created an attachment (id=2021)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=2021&action=view)
Apply the read lock to getenv()
When getenv() is being called, if "setenv(), unsetenv(), clearenv()" set
"__environ" to NULL on another cpu, the program will result in segmentation
fault.
In glibc, getenv() is called by many functions which are thread safety in
POSIX. So when we use the setenv(),unsetenv(), clearenv(), we can't use those
functions by multi-thread method. I think it should be modified.
I've made a patch to fix it. It applied a read lock in getenv() and write
locks in setenv(), unsetenv(), clearenv().
--
http://sourceware.org/bugzilla/show_bug.cgi?id=5069
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.