pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Repair double-free in SP-GIST rescan (bug #15378) 4+ messages / 1 participants [nested] [flat]
* pgsql: Repair double-free in SP-GIST rescan (bug #15378) @ 2018-09-11 18:58 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Andrew Gierth @ 2018-09-11 18:58 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Repair double-free in SP-GIST rescan (bug #15378) spgrescan would first reset traversalCxt, and then traverse a potentially non-empty stack containing pointers to traversalValues which had been allocated in those contexts, freeing them a second time. This bug originates in commit ccd6eb49a where traversalValue was introduced. Repair by traversing the stack before the context reset; this isn't ideal, since it means doing retail pfree in a context that's about to be reset, but the freeing of a stack entry is also done in other places in the code during the scan so it's not worth trying to refactor it further. Regression test added. Backpatch to 9.6 where the problem was introduced. Per bug #15378; analysis and patch by me, originally from a report on IRC by user velix; see also PostGIS ticket #4174; review by Alexander Korotkov. Discussion: https://postgr.es/m/153663176628.23136.11901365223750051490@wrigleys.postgresql.org Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/84a3a1e55c86a104a8e259a43ed31814e010954f Modified Files -------------- src/backend/access/spgist/spgscan.c | 10 +++++++--- src/test/regress/expected/spgist.out | 18 ++++++++++++++++++ src/test/regress/sql/spgist.sql | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Repair double-free in SP-GIST rescan (bug #15378) @ 2018-09-11 18:58 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Andrew Gierth @ 2018-09-11 18:58 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Repair double-free in SP-GIST rescan (bug #15378) spgrescan would first reset traversalCxt, and then traverse a potentially non-empty stack containing pointers to traversalValues which had been allocated in those contexts, freeing them a second time. This bug originates in commit ccd6eb49a where traversalValue was introduced. Repair by traversing the stack before the context reset; this isn't ideal, since it means doing retail pfree in a context that's about to be reset, but the freeing of a stack entry is also done in other places in the code during the scan so it's not worth trying to refactor it further. Regression test added. Backpatch to 9.6 where the problem was introduced. Per bug #15378; analysis and patch by me, originally from a report on IRC by user velix; see also PostGIS ticket #4174; review by Alexander Korotkov. Discussion: https://postgr.es/m/153663176628.23136.11901365223750051490@wrigleys.postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e331d6712f0224160d2699591704ddcc3ef2d67b Modified Files -------------- src/backend/access/spgist/spgscan.c | 10 +++++++--- src/test/regress/expected/spgist.out | 18 ++++++++++++++++++ src/test/regress/sql/spgist.sql | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Repair double-free in SP-GIST rescan (bug #15378) @ 2018-09-11 18:58 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Andrew Gierth @ 2018-09-11 18:58 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Repair double-free in SP-GIST rescan (bug #15378) spgrescan would first reset traversalCxt, and then traverse a potentially non-empty stack containing pointers to traversalValues which had been allocated in those contexts, freeing them a second time. This bug originates in commit ccd6eb49a where traversalValue was introduced. Repair by traversing the stack before the context reset; this isn't ideal, since it means doing retail pfree in a context that's about to be reset, but the freeing of a stack entry is also done in other places in the code during the scan so it's not worth trying to refactor it further. Regression test added. Backpatch to 9.6 where the problem was introduced. Per bug #15378; analysis and patch by me, originally from a report on IRC by user velix; see also PostGIS ticket #4174; review by Alexander Korotkov. Discussion: https://postgr.es/m/153663176628.23136.11901365223750051490@wrigleys.postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c02b56869439281d139d47dae784e3f7cf765f2d Modified Files -------------- src/backend/access/spgist/spgscan.c | 10 +++++++--- src/test/regress/expected/spgist.out | 18 ++++++++++++++++++ src/test/regress/sql/spgist.sql | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Repair double-free in SP-GIST rescan (bug #15378) @ 2018-09-11 18:58 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Andrew Gierth @ 2018-09-11 18:58 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Repair double-free in SP-GIST rescan (bug #15378) spgrescan would first reset traversalCxt, and then traverse a potentially non-empty stack containing pointers to traversalValues which had been allocated in those contexts, freeing them a second time. This bug originates in commit ccd6eb49a where traversalValue was introduced. Repair by traversing the stack before the context reset; this isn't ideal, since it means doing retail pfree in a context that's about to be reset, but the freeing of a stack entry is also done in other places in the code during the scan so it's not worth trying to refactor it further. Regression test added. Backpatch to 9.6 where the problem was introduced. Per bug #15378; analysis and patch by me, originally from a report on IRC by user velix; see also PostGIS ticket #4174; review by Alexander Korotkov. Discussion: https://postgr.es/m/153663176628.23136.11901365223750051490@wrigleys.postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/500d49794f1f61cb20f485bd5c5052c122e58cf9 Modified Files -------------- src/backend/access/spgist/spgscan.c | 10 +++++++--- src/test/regress/expected/spgist.out | 18 ++++++++++++++++++ src/test/regress/sql/spgist.sql | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-09-11 18:58 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-09-11 18:58 pgsql: Repair double-free in SP-GIST rescan (bug #15378) Andrew Gierth <rhodiumtoad@postgresql.org> 2018-09-11 18:58 pgsql: Repair double-free in SP-GIST rescan (bug #15378) Andrew Gierth <rhodiumtoad@postgresql.org> 2018-09-11 18:58 pgsql: Repair double-free in SP-GIST rescan (bug #15378) Andrew Gierth <rhodiumtoad@postgresql.org> 2018-09-11 18:58 pgsql: Repair double-free in SP-GIST rescan (bug #15378) Andrew Gierth <rhodiumtoad@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