This is the mail archive of the 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]

Re: Making getenv more multi-threading--robust?

On Thursday, September 13, 2012 12:11:48 Stephan Bergmann wrote:
> I stumbled over this when running the LibreOffice test suite and
> getting sporadic crashes in getenv(3).  It turns out that LibreOffice
> contains many places that call getenv (mostly to check whether to
> enable one tweak or another) at arbitrary times and from arbitrary
> threads, and apparently also contains the odd call to setenv etc. to
> modify the environment.
> Though getenv is generally known to not be thread-safe, glibc already
> contains measures to make concurrent calls to setenv etc. thread-safe,
> so I wonder whether something like the attached
> 0001-Prevent-races-when-getenv-walks-__environ-while-sete.patch would
> make sense.  While this would not solve my problems with
> (cross-platform) LibreOffice, it would help prevent glibc getenv
> crashes as demonstrated by the little program in the patch's commit
> message.
> Stephan

Stephan, please send patches to the libc-alpha mailing list. A patch 
would also need a proper changelog entry - for details see

In general the patch looks fine, but let's discuss this on the other 

Thanks a lot for your contribution!
 Andreas Jaeger aj@{,} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

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