public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Tom Lane <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Date: Tue, 18 Jan 2022 17:49:57 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CA+TgmoYx5=1A2K9JYV-9zdhyokU4KKTyNQ9q7CiXrX=YBBMWVw@mail.gmail.com>
	<[email protected]>

On 2022-01-18 17:12:00 -0500, Tom Lane wrote:
> Robert Haas <[email protected]> writes:
> > Unfortunately, I can't reproduce this locally, even with COPT=-Wall
> > -Werror -fno-omit-frame-pointer -fsanitize-trap=alignment
> > -Wno-deprecated-declarations -DWRITE_READ_PARSE_PLAN_TREES
> > -DSTRESS_SORT_INT_MIN -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS.
>
> Now that I re-read what you did, I believe you need both of
>
> -fsanitize=alignment -fsanitize-trap=alignment
>
> to enable those traps to happen.  That seems to be the case with
> Apple's clang, anyway.

FWIW, I can reproduce it on linux, but only if I -fno-sanitize-recover instead
of -fsanitize-trap=alignment. That then also produces a nicer explanation of
the problem:

/home/andres/src/postgresql/src/backend/replication/basebackup.c:1552:10: runtime error: member access within misaligned address 0x000002b9ce09 for type 'PageHeaderData' (aka 'struct PageHeaderData'), which requires 4 byte alignment
0x000002b9ce09: note: pointer points here
 00 00 00  64 00 00 00 00 c8 ad 0c  01 c5 1b 00 00 48 00 f0  1f f0 1f 04 20 00 00 00  00 62 31 05 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/andres/src/postgresql/src/backend/replication/basebackup.c:1552:10 in
2022-01-18 17:36:17.746 PST [1448756] LOG:  server process (PID 1448774) exited with exit code 1
2022-01-18 17:36:17.746 PST [1448756] DETAIL:  Failed process was running: BASE_BACKUP ( LABEL 'pg_basebackup base backup',  PROGRESS,  CHECKPOINT 'fast',  MANIFEST 'yes',  TARGET 'client')

The problem originates in bbsink_copystream_begin_backup()...

Greetings,

Andres Freund






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
  In-Reply-To: <[email protected]>

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

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