[Bug 258360] race between setlocale() and iconv_open() causes segfault

[email protected]
Newsgroups gmane.os.freebsd.devel.threading
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258360

Mark Johnston <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open

--- Comment #2 from Mark Johnston <[email protected]> ---
(In reply to Xin LI from comment #1)
The basic problem is that localeconv_l() updates the global lconv lazily.  When
setlocale() updates the process-global locale, it sets a couple of flags,
monetary_locale_changed and numeric_locale_changed, to indicate that the lconv
needs to be reloaded.  But setlocale() sets those flags before it's actually
finished doing some swizzling.

Note that the problem doesn't directly involve iconv_open(), it just happens to
be triggered because iconv calls snprintf() at some point.  I'm having a hard
time understanding what guarantees we're supposed to provide here, POSIX
doesn't seem to say much about thread-safety and setlocale(), but it seems
pretty reasonable to expect localeconv_l() to behave correctly wrt a concurrent
setlocale() call, though.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.