pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix tuple_data_split() to not open a relation without any lock.
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix tuple_data_split() to not open a relation without any lock.
@ 2018-10-01 15:51 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2018-10-01 15:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix tuple_data_split() to not open a relation without any lock.

contrib/pageinspect's tuple_data_split() function thought it could get
away with opening the referenced relation with NoLock.  In practice
there's no guarantee that the current session holds any lock on that
rel (even if we just read a page from it), so that this is unsafe.

Switch to using AccessShareLock.  Also, postpone closing the relation,
so that we needn't copy its tupdesc.  Also, fix unsafe use of
att_isnull() for attributes past the end of the tuple.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

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

Branch
------
master

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

Modified Files
--------------
contrib/pageinspect/heapfuncs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



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

* pgsql: Fix tuple_data_split() to not open a relation without any lock.
@ 2018-10-01 15:51 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2018-10-01 15:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix tuple_data_split() to not open a relation without any lock.

contrib/pageinspect's tuple_data_split() function thought it could get
away with opening the referenced relation with NoLock.  In practice
there's no guarantee that the current session holds any lock on that
rel (even if we just read a page from it), so that this is unsafe.

Switch to using AccessShareLock.  Also, postpone closing the relation,
so that we needn't copy its tupdesc.  Also, fix unsafe use of
att_isnull() for attributes past the end of the tuple.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

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

Branch
------
REL_11_STABLE

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

Modified Files
--------------
contrib/pageinspect/heapfuncs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



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

* pgsql: Fix tuple_data_split() to not open a relation without any lock.
@ 2018-10-01 15:51 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2018-10-01 15:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix tuple_data_split() to not open a relation without any lock.

contrib/pageinspect's tuple_data_split() function thought it could get
away with opening the referenced relation with NoLock.  In practice
there's no guarantee that the current session holds any lock on that
rel (even if we just read a page from it), so that this is unsafe.

Switch to using AccessShareLock.  Also, postpone closing the relation,
so that we needn't copy its tupdesc.  Also, fix unsafe use of
att_isnull() for attributes past the end of the tuple.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/370b28ccd430ed90125e8a2e016c617658f11b9f

Modified Files
--------------
contrib/pageinspect/heapfuncs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



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

* pgsql: Fix tuple_data_split() to not open a relation without any lock.
@ 2018-10-01 15:51 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2018-10-01 15:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix tuple_data_split() to not open a relation without any lock.

contrib/pageinspect's tuple_data_split() function thought it could get
away with opening the referenced relation with NoLock.  In practice
there's no guarantee that the current session holds any lock on that
rel (even if we just read a page from it), so that this is unsafe.

Switch to using AccessShareLock.  Also, postpone closing the relation,
so that we needn't copy its tupdesc.  Also, fix unsafe use of
att_isnull() for attributes past the end of the tuple.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

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

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
contrib/pageinspect/heapfuncs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2018-10-01 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 15:51 pgsql: Fix tuple_data_split() to not open a relation without any lock. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-01 15:51 pgsql: Fix tuple_data_split() to not open a relation without any lock. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-01 15:51 pgsql: Fix tuple_data_split() to not open a relation without any lock. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-01 15:51 pgsql: Fix tuple_data_split() to not open a relation without any lock. 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