pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix race condition in gettext() initialization in libpq and ecpg
Date: Fri, 21 Jan 2022 20:36:44 +0000
Message-ID: <E1nB0eK-0003Mf-GE@gemulon.postgresql.org> (raw)

Fix race condition in gettext() initialization in libpq and ecpglib.

In libpq and ecpglib, multiple threads can concurrently enter the
initialization logic for message localization.  Since we set the
its-done flag before actually doing the work, it'd be possible
for some threads to reach gettext() before anyone has called
bindtextdomain().  Barring bugs in libintl itself, this would not
result in anything worse than failure to localize some early
messages.  Nonetheless, it's a bug, and an easy one to fix.

Noted while investigating bug #17299 from Clemens Zeidler
(much thanks to Liam Bowen for followup investigation on that).
It currently appears that that actually *is* a bug in libintl itself,
but that doesn't let us off the hook for this bit.

Back-patch to all supported versions.

Discussion: https://postgr.es/m/17299-7270741958c0b1ab@postgresql.org
Discussion: https://postgr.es/m/CAE7q7Eit4Eq2=bxce=Fm8HAStECjaXUE=WBQc-sDDcgJQ7s7eg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1f655fdc39352c813a83a0a0f1e932af9ef2b6de

Modified Files
--------------
src/interfaces/ecpg/ecpglib/misc.c | 11 +++++++++--
src/interfaces/libpq/fe-misc.c     | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1nB0eK-0003Mf-GE@gemulon.postgresql.org>
Permalink:  ../E1nB0eK-0003Mf-GE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nB0eK-0003Mf-GE@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix race condition in gettext() initialization in libpq and ecpg
  In-Reply-To: <E1nB0eK-0003Mf-GE@gemulon.postgresql.org>
  References: <E1nB0eK-0003Mf-GE@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox