pgsql: Fix explicit valgrind interaction in read_stream.c. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Fix explicit valgrind interaction in read_stream.c.
Date
Msg-id E1tj5s6-007Aic-31@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix explicit valgrind interaction in read_stream.c.

By calling wipe_mem() on per-buffer data memory that has been released,
we are also telling Valgrind that the memory is "noaccess".  We need to
set it to "undefined" before giving it to the registered callback to
fill in, when a slot is reused.

As discovered by build farm animal skink when the VACUUM streamification
patches landed (the first users of per-buffer data).

Pushing to master only for now, to clear the error on skink.  It's also
possible that external code might discover the per-buffer data feature
in v17, and reasonable to expect Valgrind not to produce spurious
memcheck reports, but the back-patch is deferred until after the
imminent minor release is out of the way.

Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2Bg6aXpi2FEHqeLOzE%2BxYw%3DOV%2B-N5jhOEnnV%2BF0USM9xA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2a8a00674e973dec4d7d74d5e16c7d7cdedf2be5

Modified Files
--------------
src/backend/storage/aio/read_stream.c | 38 +++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Fix PQescapeLiteral()/PQescapeIdentifier() length handling
Next
From: Tom Lane
Date:
Subject: pgsql: Make escaping functions retain trailing bytes of an invalid char