[COMMITTERS] pgsql: Fix two violations of the ResourceOwnerEnlarge/Rememberprotocol - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Fix two violations of the ResourceOwnerEnlarge/Rememberprotocol
Date
Msg-id E1eCYHd-0006vY-1Q@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix two violations of the ResourceOwnerEnlarge/Remember protocol.

The point of having separate ResourceOwnerEnlargeFoo and
ResourceOwnerRememberFoo functions is so that resource allocation
can happen in between.  Doing it in some other order is just wrong.

OpenTemporaryFile() did open(), enlarge, remember, which would leak the
open file if the enlarge step ran out of memory.  Because fd.c has its own
layer of resource-remembering, the consequences look like they'd be limited
to an intratransaction FD leak, but it's still not good.

IncrBufferRefCount() did enlarge, remember, incr-refcount, which would blow
up if the incr-refcount step ever failed.  It was safe enough when written,
but since the introduction of PrivateRefCountHash, I think the assumption
that no error could happen there is pretty shaky.

The odds of real problems from either bug are probably small, but still,
back-patch to supported branches.

Thomas Munro and Tom Lane, per a comment from Andres Freund

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c |  2 +-
src/backend/storage/file/fd.c       | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: [COMMITTERS] pgsql: Change TRUE/FALSE to true/false
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Doc: fix erroneous example.