pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p @ 2016-04-14 23:42 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-04-14 23:42 UTC (permalink / raw) To: pgsql-committers Fix core dump in ReorderBufferRestoreChange on alignment-picky platforms. When re-reading an update involving both an old tuple and a new tuple from disk, reorderbuffer.c was careless about whether the new tuple is suitably aligned for direct access --- in general, it isn't. We'd missed seeing this in the buildfarm because the contrib/test_decoding tests exercise this code path only a few times, and by chance all of those cases have old tuples with length a multiple of 4, which is usually enough to make the access to the new tuple's t_len safe. For some still-not-entirely-clear reason, however, Debian's sparc build gets a bus error, as reported by Christoph Berg; perhaps it's assuming 8-byte alignment of the pointer? The lack of previous field reports is probably because you need all of these conditions to trigger a crash: an alignment-picky platform (not Intel), a transaction large enough to spill to disk, an update within that xact that changes a primary-key field and has an odd-length old tuple, and of course logical decoding tracing the transaction. Avoid the alignment assumption by using memcpy instead of fetching t_len directly, and add a test case that exposes the crash on picky platforms. Back-patch to 9.4 where the bug was introduced. Discussion: <20160413094117.GC21485@msg.credativ.de> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e7a456174b2eca37b141952b6f7ef4254887f819 Modified Files -------------- contrib/test_decoding/expected/ddl.out | 21 ++++++++++++++------- contrib/test_decoding/sql/ddl.sql | 4 ++++ src/backend/replication/logical/reorderbuffer.c | 12 ++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p @ 2016-04-14 23:42 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-04-14 23:42 UTC (permalink / raw) To: pgsql-committers Fix core dump in ReorderBufferRestoreChange on alignment-picky platforms. When re-reading an update involving both an old tuple and a new tuple from disk, reorderbuffer.c was careless about whether the new tuple is suitably aligned for direct access --- in general, it isn't. We'd missed seeing this in the buildfarm because the contrib/test_decoding tests exercise this code path only a few times, and by chance all of those cases have old tuples with length a multiple of 4, which is usually enough to make the access to the new tuple's t_len safe. For some still-not-entirely-clear reason, however, Debian's sparc build gets a bus error, as reported by Christoph Berg; perhaps it's assuming 8-byte alignment of the pointer? The lack of previous field reports is probably because you need all of these conditions to trigger a crash: an alignment-picky platform (not Intel), a transaction large enough to spill to disk, an update within that xact that changes a primary-key field and has an odd-length old tuple, and of course logical decoding tracing the transaction. Avoid the alignment assumption by using memcpy instead of fetching t_len directly, and add a test case that exposes the crash on picky platforms. Back-patch to 9.4 where the bug was introduced. Discussion: <20160413094117.GC21485@msg.credativ.de> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6a3d3965d6d5eec30e1c36b3ffa3355ee9201933 Modified Files -------------- contrib/test_decoding/expected/ddl.out | 11 +++++++++-- contrib/test_decoding/sql/ddl.sql | 4 ++++ src/backend/replication/logical/reorderbuffer.c | 12 ++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p @ 2016-04-14 23:42 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-04-14 23:42 UTC (permalink / raw) To: pgsql-committers Fix core dump in ReorderBufferRestoreChange on alignment-picky platforms. When re-reading an update involving both an old tuple and a new tuple from disk, reorderbuffer.c was careless about whether the new tuple is suitably aligned for direct access --- in general, it isn't. We'd missed seeing this in the buildfarm because the contrib/test_decoding tests exercise this code path only a few times, and by chance all of those cases have old tuples with length a multiple of 4, which is usually enough to make the access to the new tuple's t_len safe. For some still-not-entirely-clear reason, however, Debian's sparc build gets a bus error, as reported by Christoph Berg; perhaps it's assuming 8-byte alignment of the pointer? The lack of previous field reports is probably because you need all of these conditions to trigger a crash: an alignment-picky platform (not Intel), a transaction large enough to spill to disk, an update within that xact that changes a primary-key field and has an odd-length old tuple, and of course logical decoding tracing the transaction. Avoid the alignment assumption by using memcpy instead of fetching t_len directly, and add a test case that exposes the crash on picky platforms. Back-patch to 9.4 where the bug was introduced. Discussion: <20160413094117.GC21485@msg.credativ.de> Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/00456911f43ab3def50b70813aea645e979e1687 Modified Files -------------- contrib/test_decoding/expected/ddl.out | 21 ++++++++++++++------- contrib/test_decoding/sql/ddl.sql | 4 ++++ src/backend/replication/logical/reorderbuffer.c | 12 ++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-04-14 23:42 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-04-14 23:42 pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p Tom Lane <tgl@sss.pgh.pa.us> 2016-04-14 23:42 pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p Tom Lane <tgl@sss.pgh.pa.us> 2016-04-14 23:42 pgsql: Fix core dump in ReorderBufferRestoreChange on alignment-picky p 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