This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/5069] env thread safety problem


------- 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]