Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Sep 2021 13:37:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        threads@FreeBSD.org
Subject:   [Bug 258360] race between setlocale() and iconv_open() causes segfault
Message-ID:  <bug-258360-13406-yM5nOjuirq@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-258360-13406@https.bugs.freebsd.org/bugzilla/>
References:  <bug-258360-13406@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258360

Mark Johnston <markj@FreeBSD.org> changed:

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

--- Comment #2 from Mark Johnston <markj@FreeBSD.org> ---
(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 lc=
onv
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 happen=
s to
be triggered because iconv calls snprintf() at some point.  I'm having a ha=
rd
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 concur=
rent
setlocale() call, though.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-258360-13406-yM5nOjuirq>