pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix segment_bins corruption in dsa.c.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix segment_bins corruption in dsa.c.
@ 2018-09-20 04:32 Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2018-09-20 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix segment_bins corruption in dsa.c.

If a segment has been freed by dsa.c because it is entirely empty, other
backends must make sure to unmap it before following links to new
segments that might happen to have the same index number, or they could
finish up looking at a defunct segment and then corrupt the segment_bins
lists.  The correct protocol requires checking freed_segment_counter
after acquiring the area lock and before resolving any index number to a
segment.  Add the missing checks and an assertion.

Back-patch to 10, where dsa.c first arrived.

Author: Thomas Munro
Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/CAEepm%3D0thg%2Bja5zGVa7jBy-uqyHrTqTm8HGhEOtMmigGrAqTbw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/38763d67784c6563d08dbea5c9f913fa174779b8

Modified Files
--------------
src/backend/utils/mmgr/dsa.c | 50 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 5 deletions(-)



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

* pgsql: Fix segment_bins corruption in dsa.c.
@ 2018-09-20 04:32 Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2018-09-20 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix segment_bins corruption in dsa.c.

If a segment has been freed by dsa.c because it is entirely empty, other
backends must make sure to unmap it before following links to new
segments that might happen to have the same index number, or they could
finish up looking at a defunct segment and then corrupt the segment_bins
lists.  The correct protocol requires checking freed_segment_counter
after acquiring the area lock and before resolving any index number to a
segment.  Add the missing checks and an assertion.

Back-patch to 10, where dsa.c first arrived.

Author: Thomas Munro
Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/CAEepm%3D0thg%2Bja5zGVa7jBy-uqyHrTqTm8HGhEOtMmigGrAqTbw%40mail.gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/utils/mmgr/dsa.c | 50 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 5 deletions(-)



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

* pgsql: Fix segment_bins corruption in dsa.c.
@ 2018-09-20 04:33 Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2018-09-20 04:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix segment_bins corruption in dsa.c.

If a segment has been freed by dsa.c because it is entirely empty, other
backends must make sure to unmap it before following links to new
segments that might happen to have the same index number, or they could
finish up looking at a defunct segment and then corrupt the segment_bins
lists.  The correct protocol requires checking freed_segment_counter
after acquiring the area lock and before resolving any index number to a
segment.  Add the missing checks and an assertion.

Back-patch to 10, where dsa.c first arrived.

Author: Thomas Munro
Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/CAEepm%3D0thg%2Bja5zGVa7jBy-uqyHrTqTm8HGhEOtMmigGrAqTbw%40mail.gmail.com

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/backend/utils/mmgr/dsa.c | 50 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 5 deletions(-)



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


end of thread, other threads:[~2018-09-20 04:33 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 04:32 pgsql: Fix segment_bins corruption in dsa.c. Thomas Munro <tmunro@postgresql.org>
2018-09-20 04:32 pgsql: Fix segment_bins corruption in dsa.c. Thomas Munro <tmunro@postgresql.org>
2018-09-20 04:33 pgsql: Fix segment_bins corruption in dsa.c. Thomas Munro <tmunro@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