Potential locking issue in newlocale

Paolo Carlini pcarlini@suse.de
Fri Jul 16 09:22:00 GMT 2004


Hi Ulrich, hi everyone

 > And in fact, in one crash I have analysed, it looks as if glibc-internal
 > data structures are corrupted.

As a very empirical data point, supporting your conjecture, a few days ago
I tried wrapping in a mutex the call of 
locale::facet::_S_create_c_locale(__cloc, __s)
present in locale::_Impl::_Impl(const char*, size_t).
The former, I recall, is just:

  void
  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
                                    __c_locale __old)
  {
    __cloc = __newlocale(1 << LC_ALL, __s, __old);
    if (!__cloc)
      {
        // This named locale is not supported by the underlying OS.
        __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
                              "name not valid"));
      }
  }

and, to my *very* big surprise, the testcase did *not* fail anymore on 4-way
x86_64...

Thanks,
Paolo.



More information about the Libc-alpha mailing list