pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid torn copy of the control file in base backups
Date: Tue, 27 Oct 2026 23:46:27 +0000
Message-ID: <E1xLqs7-000000013Ft-2Kky@gemulon.postgresql.org> (raw)

Avoid torn copy of the control file in base backups

Base backups read the control file (pg_control) from disk without any
protection against concurrent writes by the server, making it exposed to
torn copies.  Attempting to use such a control file at startup would
cause a failure with a CRC not matching.

Base backups now read the control file while holding ControlFileLock.
c558e6fd92f has done the same for some SQL functions.  The contents of
the file are saved in memory and sent over the wire as-is.

Backpatch down to v15.  This issue is older than v15 but v14 is left out
of the picture as it is going to be EOL soon, so it does not seem worth
taking a risk for.

Author: David Steele <david@pgbackrest.org>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/d1697de1-eb7f-41bf-a4b7-bba7203df11f@pgbackrest.org
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/316a870654a382d7c91b88f4c0dcc7cbb2f2c0be

Modified Files
--------------
src/backend/backup/basebackup.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)



view thread (6+ messages)

Message-ID: <E1xLqs7-000000013Ft-2Kky@gemulon.postgresql.org>
Permalink:  ../E1xLqs7-000000013Ft-2Kky@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xLqs7-000000013Ft-2Kky@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: michael@paquier.xyz
  Subject: Re: pgsql: Avoid torn copy of the control file in base backups
  In-Reply-To: <E1xLqs7-000000013Ft-2Kky@gemulon.postgresql.org>
  References: <E1xLqs7-000000013Ft-2Kky@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