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 bogus initialization of replication origin shared memory sta
Date: Fri, 15 May 2020 23:06:05 +0000
Message-ID: <E1jZjP3-0001CU-T6@gemulon.postgresql.org> (raw)

Fix bogus initialization of replication origin shared memory state.

The previous coding zeroed out offsetof(ReplicationStateCtl, states)
more bytes than it was entitled to, as a consequence of starting the
zeroing from the wrong pointer (or, if you prefer, using the wrong
calculation of how much to zero).

It's unsurprising that this has not caused any reported problems,
since it can be expected that the newly-allocated block is at the end
of what we've used in shared memory, and we always make the shmem
block substantially bigger than minimally necessary.  Nonetheless,
this is wrong and it could bite us someday; plus it's a dangerous
model for somebody to copy.

This dates back to the introduction of this code (commit 5aa235042),
so back-patch to all supported branches.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ee39a4b9e475348dd3de82781a54be82e63a3186

Modified Files
--------------
src/backend/replication/logical/origin.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



view thread (6+ messages)

Message-ID: <E1jZjP3-0001CU-T6@gemulon.postgresql.org>
Permalink:  ../E1jZjP3-0001CU-T6@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jZjP3-0001CU-T6@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix bogus initialization of replication origin shared memory sta
  In-Reply-To: <E1jZjP3-0001CU-T6@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