public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4350] New: Reentrancy problem between strftime() and setenv()
@ 2007-04-12 13:42 pasky at suse dot cz
  2007-04-12 13:43 ` [Bug libc/4350] " pasky at suse dot cz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pasky at suse dot cz @ 2007-04-12 13:42 UTC (permalink / raw)
  To: glibc-bugs

Threaded programs may crash randomly if strftime() and setenv() aren't excluded
from being called in parallel, since getenv() is called from the inside of
strftime(). While getenv()-setenv() thread safety problems are documented, it is
not documented that time functions have these problems as well. The proposed
patch introduces getenv_r() as a reentrant version of getenv() and uses it from
inside of the time functions; maybe you'll choose a different approach (or a
different name for the function or so), but something should be done about this.
Also, maybe other parts of glibc making use of getenv() might need the same fix.

-- 
           Summary: Reentrancy problem between strftime() and setenv()
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: pasky at suse dot cz
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4350

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4350] Reentrancy problem between strftime() and setenv()
  2007-04-12 13:42 [Bug libc/4350] New: Reentrancy problem between strftime() and setenv() pasky at suse dot cz
@ 2007-04-12 13:43 ` pasky at suse dot cz
  2007-04-12 13:45 ` pasky at suse dot cz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pasky at suse dot cz @ 2007-04-12 13:43 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From pasky at suse dot cz  2007-04-12 14:43 -------
Created an attachment (id=1676)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1676&action=view)
Proposed patch


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4350

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4350] Reentrancy problem between strftime() and setenv()
  2007-04-12 13:42 [Bug libc/4350] New: Reentrancy problem between strftime() and setenv() pasky at suse dot cz
  2007-04-12 13:43 ` [Bug libc/4350] " pasky at suse dot cz
@ 2007-04-12 13:45 ` pasky at suse dot cz
  2007-04-13 17:50 ` jakub at redhat dot com
  2007-04-26 17:11 ` pasky at suse dot cz
  3 siblings, 0 replies; 5+ messages in thread
From: pasky at suse dot cz @ 2007-04-12 13:45 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From pasky at suse dot cz  2007-04-12 14:45 -------
(Forgot to mention that the patch was written only partially by me, a large part
came from a customer of Novell.)

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4350

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4350] Reentrancy problem between strftime() and setenv()
  2007-04-12 13:42 [Bug libc/4350] New: Reentrancy problem between strftime() and setenv() pasky at suse dot cz
  2007-04-12 13:43 ` [Bug libc/4350] " pasky at suse dot cz
  2007-04-12 13:45 ` pasky at suse dot cz
@ 2007-04-13 17:50 ` jakub at redhat dot com
  2007-04-26 17:11 ` pasky at suse dot cz
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at redhat dot com @ 2007-04-13 17:50 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-04-13 18:50 -------
strftime is documented in POSIX that it acts as if it calls tzset().
And tzset is documented to inspect the TZ env variable.
setenv is documented to be non-thread safe, what glibc does there is beyond
what the standard requires.  And this is IMHO the same thing.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4350

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4350] Reentrancy problem between strftime() and setenv()
  2007-04-12 13:42 [Bug libc/4350] New: Reentrancy problem between strftime() and setenv() pasky at suse dot cz
                   ` (2 preceding siblings ...)
  2007-04-13 17:50 ` jakub at redhat dot com
@ 2007-04-26 17:11 ` pasky at suse dot cz
  3 siblings, 0 replies; 5+ messages in thread
From: pasky at suse dot cz @ 2007-04-26 17:11 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From pasky at suse dot cz  2007-04-26 18:11 -------
Strictly speaking, it doesn't say that it inspects $TZ in a non-reentrant way
(using getenv()), does it? But I agree that this is quite a nitpicking. But
still, what are the considerations against integrating such a patch? Just the
possible small performance penalty?

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4350

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-26 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-12 13:42 [Bug libc/4350] New: Reentrancy problem between strftime() and setenv() pasky at suse dot cz
2007-04-12 13:43 ` [Bug libc/4350] " pasky at suse dot cz
2007-04-12 13:45 ` pasky at suse dot cz
2007-04-13 17:50 ` jakub at redhat dot com
2007-04-26 17:11 ` pasky at suse dot cz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).