pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid using a fake relcache entry to own an SmgrRelation.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid using a fake relcache entry to own an SmgrRelation.
@ 2022-08-12 12:56  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2022-08-12 12:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid using a fake relcache entry to own an SmgrRelation.

If an error occurs before we close the fake relcache entry, the the
fake relcache entry will be destroyed by the SmgrRelation will
survive until end of transaction. Its smgr_owner pointer ends up
pointing to already-freed memory.

The original reason for using a fake relcache entry here was to try
to avoid reusing an SMgrRelation across a relevant invalidation. To
avoid that problem, just call smgropen() again each time we need a
reference to it. Hopefully someday we will come up with a more
elegant approach, but accessing uninitialized memory is bad so let's
do this for now.

Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by
Justin Pryzby.

Discussion: http://postgr.es/m/20220802175043.GA13682@telsasoft.com
Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76733b399c490885564a560718de23d98bb5e66d

Modified Files
--------------
src/backend/commands/dbcommands.c   | 15 +++--------
src/backend/storage/buffer/bufmgr.c | 51 +++++++++++++++++--------------------
2 files changed, 28 insertions(+), 38 deletions(-)



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

* pgsql: Avoid using a fake relcache entry to own an SmgrRelation.
@ 2022-08-12 12:56  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2022-08-12 12:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid using a fake relcache entry to own an SmgrRelation.

If an error occurs before we close the fake relcache entry, the the
fake relcache entry will be destroyed by the SmgrRelation will
survive until end of transaction. Its smgr_owner pointer ends up
pointing to already-freed memory.

The original reason for using a fake relcache entry here was to try
to avoid reusing an SMgrRelation across a relevant invalidation. To
avoid that problem, just call smgropen() again each time we need a
reference to it. Hopefully someday we will come up with a more
elegant approach, but accessing uninitialized memory is bad so let's
do this for now.

Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by
Justin Pryzby.

Discussion: http://postgr.es/m/20220802175043.GA13682@telsasoft.com
Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1b94f8f232f681890680a866f79dce649a78bd2d

Modified Files
--------------
src/backend/commands/dbcommands.c   | 15 +++--------
src/backend/storage/buffer/bufmgr.c | 51 +++++++++++++++++--------------------
2 files changed, 28 insertions(+), 38 deletions(-)



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


end of thread, other threads:[~2022-08-12 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 12:56 pgsql: Avoid using a fake relcache entry to own an SmgrRelation. Robert Haas <rhaas@postgresql.org>
2022-08-12 12:56 pgsql: Avoid using a fake relcache entry to own an SmgrRelation. Robert Haas <rhaas@postgresql.org>

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