On 2022-01-18 17:12:00 -0500, Tom Lane wrote:
> Robert Haas <robertmh...@gmail.com> 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


Reply via email to