public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug time/19179] New: gmtime_r internally calls getenv("TZ") which is not thread-safe
@ 2015-10-28 15:23 nszabolcs at gmail dot com
  2015-10-30  3:10 ` [Bug time/19179] " ppluzhnikov at google dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nszabolcs at gmail dot com @ 2015-10-28 15:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19179

            Bug ID: 19179
           Summary: gmtime_r internally calls getenv("TZ") which is not
                    thread-safe
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com
  Target Milestone: ---

gmtime_r should be thread-safe, but it calls tzset_internal which calls
getenv("TZ") which is non-thread-safe.

a multi-threaded application may modify the TZ env var through the
environ pointer if there is no concurrent access to this env var in
other threads.

gmtime_r is not specified to access TZ, if it does, that can introduce
a data race in a conforming application and gmtime_r may misbehave if
it observes TZ in an inconsistent state.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug time/19179] gmtime_r internally calls getenv("TZ") which is not thread-safe
  2015-10-28 15:23 [Bug time/19179] New: gmtime_r internally calls getenv("TZ") which is not thread-safe nszabolcs at gmail dot com
@ 2015-10-30  3:10 ` ppluzhnikov at google dot com
  2015-10-30  3:15 ` ppluzhnikov at google dot com
  2015-10-30 11:58 ` nszabolcs at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2015-10-30  3:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19179

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ppluzhnikov at google dot com
         Resolution|---                         |DUPLICATE

--- Comment #1 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
Dup of 14023

*** This bug has been marked as a duplicate of bug 14023 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug time/19179] gmtime_r internally calls getenv("TZ") which is not thread-safe
  2015-10-28 15:23 [Bug time/19179] New: gmtime_r internally calls getenv("TZ") which is not thread-safe nszabolcs at gmail dot com
  2015-10-30  3:10 ` [Bug time/19179] " ppluzhnikov at google dot com
@ 2015-10-30  3:15 ` ppluzhnikov at google dot com
  2015-10-30 11:58 ` nszabolcs at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ppluzhnikov at google dot com @ 2015-10-30  3:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19179

--- Comment #2 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
getenv is thread-safe (so long as other threads aren't modifying the
environment), so if getenv() was the problem, this bug would be invalid.

But tzset_internal writes globals, and is definitely not thread-safe.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug time/19179] gmtime_r internally calls getenv("TZ") which is not thread-safe
  2015-10-28 15:23 [Bug time/19179] New: gmtime_r internally calls getenv("TZ") which is not thread-safe nszabolcs at gmail dot com
  2015-10-30  3:10 ` [Bug time/19179] " ppluzhnikov at google dot com
  2015-10-30  3:15 ` ppluzhnikov at google dot com
@ 2015-10-30 11:58 ` nszabolcs at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: nszabolcs at gmail dot com @ 2015-10-30 11:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=19179

--- Comment #3 from Szabolcs Nagy <nszabolcs at gmail dot com> ---
i used the wrong words there.

getenv is thread-safe, but an application is
allowed to modify an env var concurrently with
a thread-safe function except if the function
is specified to access the environment.

gmtime_r is not specified to access the env,
so it is not allowed to call getenv.

(i.e. unconditionally thread-safe functions are
not allowed to call conditionally thread-safe
ones.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-10-30 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 15:23 [Bug time/19179] New: gmtime_r internally calls getenv("TZ") which is not thread-safe nszabolcs at gmail dot com
2015-10-30  3:10 ` [Bug time/19179] " ppluzhnikov at google dot com
2015-10-30  3:15 ` ppluzhnikov at google dot com
2015-10-30 11:58 ` nszabolcs at gmail dot com

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