pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix ReadRecentBuffer for local buffers. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix ReadRecentBuffer for local buffers. @ 2022-07-25 06:09 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2022-07-25 06:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ReadRecentBuffer for local buffers. It incorrectly used GetBufferDescriptor instead of GetLocalBufferDescriptor, causing it to not find the correct buffer in most cases, and performing an out-of-bounds memory read in the corner case that temp_buffers > shared_buffers. It also bumped the usage-count on the buffer, even if it was previously pinned. That won't lead to crashes or incorrect results, but it's different from what the shared-buffer case does, and different from the usual code in LocalBufferAlloc. Fix that too, and make the code ordering match LocalBufferAlloc() more closely, so that it's easier to verify that it's doing the same thing. Currently, ReadRecentBuffer() is only used with non-temp relations, in WAL redo, so the broken code is currently dead code. However, it could be used by extensions. Backpatch-through: 14 Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7a08f78aea95a7046816fe6a711e83615ccdb737 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix ReadRecentBuffer for local buffers. @ 2022-07-25 06:09 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2022-07-25 06:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ReadRecentBuffer for local buffers. It incorrectly used GetBufferDescriptor instead of GetLocalBufferDescriptor, causing it to not find the correct buffer in most cases, and performing an out-of-bounds memory read in the corner case that temp_buffers > shared_buffers. It also bumped the usage-count on the buffer, even if it was previously pinned. That won't lead to crashes or incorrect results, but it's different from what the shared-buffer case does, and different from the usual code in LocalBufferAlloc. Fix that too, and make the code ordering match LocalBufferAlloc() more closely, so that it's easier to verify that it's doing the same thing. Currently, ReadRecentBuffer() is only used with non-temp relations, in WAL redo, so the broken code is currently dead code. However, it could be used by extensions. Backpatch-through: 14 Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3f968b9415045c4f8ae3cd56b5b4a83d1aa27db8 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix ReadRecentBuffer for local buffers. @ 2022-07-25 06:09 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2022-07-25 06:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ReadRecentBuffer for local buffers. It incorrectly used GetBufferDescriptor instead of GetLocalBufferDescriptor, causing it to not find the correct buffer in most cases, and performing an out-of-bounds memory read in the corner case that temp_buffers > shared_buffers. It also bumped the usage-count on the buffer, even if it was previously pinned. That won't lead to crashes or incorrect results, but it's different from what the shared-buffer case does, and different from the usual code in LocalBufferAlloc. Fix that too, and make the code ordering match LocalBufferAlloc() more closely, so that it's easier to verify that it's doing the same thing. Currently, ReadRecentBuffer() is only used with non-temp relations, in WAL redo, so the broken code is currently dead code. However, it could be used by extensions. Backpatch-through: 14 Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/19f82323db6312e0f2c4483dab95189c7f110648 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-07-25 06:09 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-07-25 06:09 pgsql: Fix ReadRecentBuffer for local buffers. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2022-07-25 06:09 pgsql: Fix ReadRecentBuffer for local buffers. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2022-07-25 06:09 pgsql: Fix ReadRecentBuffer for local buffers. Heikki Linnakangas <heikki.linnakangas@iki.fi>
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