pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_stat_statements: fetch stmt location/length before it disappe
7+ messages / 1 participants
[nested] [flat]

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/56083ff3015b1beadb72724d3b9ddac81f69453c

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_12_STABLE

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

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8b0a5cf3fe48a929b26e6e305f0765cf383d2ade

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0f2f5645a1f347bad7bfa4b670ce9aacdb9e634d

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/149e00192fa1314ca26c47e7620d470681fea502

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
REL_13_STABLE

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

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)



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

* pgsql: pg_stat_statements: fetch stmt location/length before it disappe
@ 2022-11-01 16:48  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2022-11-01 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_stat_statements: fetch stmt location/length before it disappears.

When executing a utility statement, we must fetch everything
we need out of the PlannedStmt data structure before calling
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK
in extended query protocol), that data structure will get freed
during command execution.  The situation is probably often harmless
in production builds, but in debug builds we intentionally overwrite
the freed memory with garbage, leading to picking up garbage values
of statement location and length, typically causing an assertion
failure later in pg_stat_statements.  In non-debug builds, if
something did go wrong it would likely lead to storing garbage
for the query string.

Report and fix by zhaoqigui (with cosmetic adjustments by me).
It's an old problem, so back-patch to all supported versions.

Discussion: https://postgr.es/m/17663-a344fd0675f92128@postgresql.org
Discussion: https://postgr.es/m/1667307420050.56657@hundsun.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/495e73c2079eb53fcfbafbe18b7dce81aeb271ec

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2022-11-01 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe Tom Lane <tgl@sss.pgh.pa.us>
2022-11-01 16:48 pgsql: pg_stat_statements: fetch stmt location/length before it disappe 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