pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Prevent possible double-free when update trigger returns old tup
7+ messages / 1 participants
[nested] [flat]

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c         |  4 +-
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c         |  4 +-
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c         |  4 +-
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL9_4_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c         |  4 +-
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
2 files changed, 105 insertions(+)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/03813a50efa563f19110013b06e80f08d4f49cf5

Modified Files
--------------
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
2 files changed, 105 insertions(+)



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

* pgsql: Prevent possible double-free when update trigger returns old tup
@ 2019-08-16 00:05  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-08-16 00:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Prevent possible double-free when update trigger returns old tuple.

This is a variant of the problem fixed in commit 25b692568, which
unfortunately we failed to detect at the time.  If an update trigger
returns the "old" tuple, as it's entitled to do, then a subsequent
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"
equal to "trigtuple" and would fail to notice that it shouldn't
free that.

In addition to fixing the code, extend the test case added by
25b692568 so that it covers multiple-trigger-iterations cases.

This problem does not manifest in v12/HEAD, as a result of the
relevant code having been largely rewritten for slotification.
However, include the test case into v12/HEAD anyway, since this
is clearly an area that someone could break again in future.

Per report from Piotr Gabriel Kosinski.  Back-patch into all
supported branches, since the bug seems quite old.

Diagnosis and code fix by Thomas Munro, test case by me.

Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/60886965a271242c19e40483c82b41ff726ca24e

Modified Files
--------------
src/backend/commands/trigger.c         |  4 +-
src/test/regress/expected/triggers.out | 70 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 35 +++++++++++++++++
3 files changed, 108 insertions(+), 1 deletion(-)



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


end of thread, other threads:[~2019-08-16 00:05 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup Tom Lane <tgl@sss.pgh.pa.us>
2019-08-16 00:05 pgsql: Prevent possible double-free when update trigger returns old tup 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