pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Harden TAP tests that intentionally corrupt page checksums.
5+ messages / 1 participants
[nested] [flat]

* pgsql: Harden TAP tests that intentionally corrupt page checksums.
@ 2022-03-25 18:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-03-25 18:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Harden TAP tests that intentionally corrupt page checksums.

The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6e9ffcf13a4a0d56f03b4048231066cb5d061299

Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 33 ++++++++++------------------
src/bin/pg_checksums/t/002_actions.pl        |  9 ++------
src/test/perl/PostgresNode.pm                | 31 ++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 29 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Harden TAP tests that intentionally corrupt page checksums.
@ 2022-03-25 18:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-03-25 18:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Harden TAP tests that intentionally corrupt page checksums.

The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/579cef5faf11b63a312691e086415b37d7888b5a

Modified Files
--------------
contrib/amcheck/t/001_verify_heapam.pl       |  5 ++--
src/bin/pg_amcheck/t/003_check.pl            |  5 ++--
src/bin/pg_amcheck/t/004_verify_heapam.pl    |  9 ++++----
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 34 +++++++++-------------------
src/bin/pg_checksums/t/002_actions.pl        | 10 ++------
src/test/perl/PostgresNode.pm                | 31 +++++++++++++++++++++++++
6 files changed, 52 insertions(+), 42 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Harden TAP tests that intentionally corrupt page checksums.
@ 2022-03-25 18:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-03-25 18:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Harden TAP tests that intentionally corrupt page checksums.

The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3d263b09058a6ea90ed0f6143fafbb92892c7ba8

Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 33 ++++++++++------------------
src/test/perl/PostgresNode.pm                | 31 ++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 22 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Harden TAP tests that intentionally corrupt page checksums.
@ 2022-03-25 18:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-03-25 18:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Harden TAP tests that intentionally corrupt page checksums.

The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 33 ++++++++++------------------
src/bin/pg_checksums/t/002_actions.pl        |  9 ++------
src/test/perl/PostgresNode.pm                | 31 ++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 29 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Harden TAP tests that intentionally corrupt page checksums.
@ 2022-03-25 18:23  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2022-03-25 18:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Harden TAP tests that intentionally corrupt page checksums.

The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/174877f1e344812f620fd8891af97104d5dfca13

Modified Files
--------------
contrib/amcheck/t/001_verify_heapam.pl       |  5 ++--
src/bin/pg_amcheck/t/003_check.pl            |  5 ++--
src/bin/pg_amcheck/t/004_verify_heapam.pl    |  9 ++++----
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 34 +++++++++-------------------
src/bin/pg_checksums/t/002_actions.pl        | 10 ++------
src/test/perl/PostgreSQL/Test/Cluster.pm     | 31 +++++++++++++++++++++++++
6 files changed, 52 insertions(+), 42 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-03-25 18:23 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 18:23 pgsql: Harden TAP tests that intentionally corrupt page checksums. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-25 18:23 pgsql: Harden TAP tests that intentionally corrupt page checksums. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-25 18:23 pgsql: Harden TAP tests that intentionally corrupt page checksums. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-25 18:23 pgsql: Harden TAP tests that intentionally corrupt page checksums. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-25 18:23 pgsql: Harden TAP tests that intentionally corrupt page checksums. Tom Lane <tgl@sss.pgh.pa.us>

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