agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
6+ messages / 1 participants
[nested] [flat]

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/16706f1f4dc202d502f07f7b14bb600eb0daef92

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6e0011596c92d290dffe566fa851235df6b18d5b

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/203b96953e755c72d710ee3fb1b733729bd9a4d2

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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

* pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs()
@ 2026-09-17 10:26 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-09-17 10:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Tolerate partial pgstats entries in pgstat_gc_entry_refs()

pgstat_get_entry_ref_cached() inserts a local entry_ref with
shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its
sole caller) to fill them up before returning.  If an ERROR happens
while pgstat_get_entry_ref() runs, it could be possible to finish with a
local pgstats entry partially filled.

This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a
NULL shared_stats in an assertion but unconditionally dereferenced its
"dropped" and "generation" fields.

This extends 4069df21beb8, being a cheap insurance against NULL pointer
dereference, if some code paths of pgstat_get_entry_ref() are not able
to perform any cleanup actions (for example after a dsm_create()
throwing an ERROR).

Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru>
Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0016a2cc4fda8415ed524ad8645325fab7433273

Modified Files
--------------
src/backend/utils/activity/pgstat_shmem.c | 9 +++++++++
1 file changed, 9 insertions(+)



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


end of thread, other threads:[~2026-09-17 10:26 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>
2026-09-17 10:26 pgsql: Tolerate partial pgstats entries in pgstat_gc_entry_refs() Michael Paquier <michael@paquier.xyz>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox