pgsql: Fix alignment problem with bbsink_copystream buffer.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix alignment problem with bbsink_copystream buffer.
Date: 2022-01-19 13:16:06
Message-ID: E1nAAoo-0003Li-VA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix alignment problem with bbsink_copystream buffer.

bbsink_copystream wants to store a type byte just before the buffer,
but basebackup.c wants the buffer to be aligned so that it can call
PageIsNew() and PageGetLSN() on it. Therefore, instead of inserting
1 extra byte before the buffer, insert MAXIMUM_ALIGNOF extra bytes
and only use the last one.

On most machines this doesn't cause any problem (except perhaps for
performance) but some buildfarm machines with -fsanitize=alignment
dump core.

Discussion: http://postgr.es/m/CA+TgmoYx5=1A2K9JYV-9zdhyokU4KKTyNQ9q7CiXrX=YBBMWVw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f47e833bf6d96c1a2c5173c8e0f6c6cc30f9592

Modified Files
--------------
src/backend/replication/basebackup_copy.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2022-01-19 13:16:17 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Previous Message Tom Lane 2022-01-19 02:29:16 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back