pgsql: Mark buffers as defined to Valgrind consistently.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Mark buffers as defined to Valgrind consistently.
Date: 2020-07-19 16:47:43
Message-ID: E1jxCTX-0006hb-Uy@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Mark buffers as defined to Valgrind consistently.

Make PinBuffer() mark buffers as defined to Valgrind unconditionally,
including when the buffer header spinlock must be acquired. Failure to
handle that case could lead to false positive reports from Valgrind.

This theoretically creates a risk that we'll mark buffers defined even
when external callers don't end up with a buffer pin. That seems
perfectly acceptable, though, since in general we make no guarantees
about buffers that are unsafe to access being reliably marked as unsafe.

Oversight in commit 1e0dfd16, which added valgrind buffer access
instrumentation.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/46ef520b9566d9eccb095ceafa53e5c305cf80b9

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-07-19 23:13:19 pgsql: Avoid harmless Valgrind no-buffer-pin errors.
Previous Message Tom Lane 2020-07-19 16:37:38 pgsql: Correctly mark pg_subscription.subslotname as nullable.