This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: First draft of the Y2038 design document
- From: Zack Weinberg <zackw at panix dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 3 Nov 2015 09:38:48 -0500
- Subject: Re: First draft of the Y2038 design document
- Authentication-results: sourceware.org; auth=none
- References: <20151026001252 dot 590e09c1 dot albert dot aribaud at 3adev dot fr> <562EEE05 dot 1080304 at cs dot ucla dot edu> <20151027034324 dot GW8645 at brightrain dot aerifal dot cx> <562F3C6E dot 30905 at cs dot ucla dot edu> <20151027141026 dot GX8645 at brightrain dot aerifal dot cx> <562FE305 dot 7090004 at cs dot ucla dot edu> <20151027205654 dot GY8645 at brightrain dot aerifal dot cx> <562FE594 dot 1050601 at cs dot ucla dot edu> <20151027214243 dot GA8645 at brightrain dot aerifal dot cx> <562FF8AC dot 90206 at cs dot ucla dot edu> <20151027224217 dot GC8645 at brightrain dot aerifal dot cx> <56300020 dot 6090001 at cs dot ucla dot edu> <5630A213 dot 1070304 at arm dot com> <5636CBA2 dot 1000707 at cs dot ucla dot edu>
On Sun, Nov 1, 2015 at 9:34 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Szabolcs Nagy wrote:
>> if one thread changes TZ=GMT0 to TZ=GMT-1 while
>> another concurrently calls gmtime_r, then glibc
>> introduces a data race when it calls getenv("TZ").
>
> Surely any such data race will exist with localtime_r, too. If there's a bug
> in this area a bug report should be filed, and fixing the bug will most
> likely fix both localtime_r and gmtime_r.
I believe Rich has been trying to say that this data race is
_unfixable_, because applications are permitted to modify the data
pointed-to by `environ` directly, in-place, and without taking any
locks. Thus, any library function that inspects the environment is
potentially exposed to data races against modifications by another
thread, and the best we (implementors) can do is document which C
library functions examine the environment.
I do not have an informed opinion on whether POSIX defines the set of
functions that are allowed to examine the environment.
zw