Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqS4u-0000bl-Bn for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Apr 2016 21:12:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aqS4t-00089F-Lg for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Apr 2016 21:11:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aqS4s-00088o-S9 for pgsql-bugs@postgresql.org; Wed, 13 Apr 2016 21:11:59 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1aqS4p-0005wt-L6 for pgsql-bugs@postgresql.org; Wed, 13 Apr 2016 21:11:57 +0000 Received: from gauss.credativ.com (localhost [127.0.0.1]) by gauss.credativ.com (Postfix) with ESMTP id 96AF21450073; Wed, 13 Apr 2016 23:11:52 +0200 (CEST) Received: from msg.credativ.de (aftr-37-201-192-11.unity-media.net [37.201.192.11]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: cbe@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id 702131B42FA; Wed, 13 Apr 2016 23:11:52 +0200 (CEST) Date: Wed, 13 Apr 2016 23:11:52 +0200 From: Christoph Berg To: Andres Freund Cc: PostgreSQL Bugs Subject: Re: Bus error in pg_logical_slot_get_changes (9.4.7, sparc) Message-ID: <20160413211152.GA21711@msg.credativ.de> Mail-Followup-To: Christoph Berg , Andres Freund , PostgreSQL Bugs References: <20160413094117.GC21485@msg.credativ.de> <20160413161906.aykti6iwdc7zv7l6@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160413161906.aykti6iwdc7zv7l6@alap3.anarazel.de> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Re: Andres Freund 2016-04-13 <20160413161906.aykti6iwdc7zv7l6@alap3.anarazel.de> > > 2327 Size tuplelen = ((HeapTuple) data)->t_len; > > Hrmpf, I guess this is an alignment issue. We should probably replace > that ->t_len lookup with a memcpy. IIRC it's not entirely trivial to > access porter boxes anymore - could you perhaps just replace those two > t_len lookups with a memcpy (i.e. memcpy(&tuplelen, &(HeapTuple) > data)->t_len, sizeof(uint32))? That fixed the contrib/test_decoding checks, thanks. Will do another full build over night to double check. Mit freundlichen Grüßen, Christoph Berg -- Senior Berater, Tel.: +49 (0)21 61 / 46 43-187 credativ GmbH, HRB Mönchengladbach 12080, USt-ID-Nummer: DE204566209 Hohenzollernstr. 133, 41061 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer pgp fingerprint: 5C48 FE61 57F4 9179 5970 87C6 4C5A 6BAB 12D2 A7AE --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=pglogical-alignment --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2303,7 +2303,8 @@ ReorderBufferRestoreChange(ReorderBuffer case REORDER_BUFFER_CHANGE_DELETE: if (change->data.tp.oldtuple) { - Size tuplelen = ((HeapTuple) data)->t_len; + Size tuplelen; + memcpy(&tuplelen, &((HeapTuple) data)->t_len, sizeof(uint32)); change->data.tp.oldtuple = ReorderBufferGetTupleBuf(rb, tuplelen - offsetof(HeapTupleHeaderData, t_bits)); @@ -2324,7 +2325,8 @@ ReorderBufferRestoreChange(ReorderBuffer if (change->data.tp.newtuple) { - Size tuplelen = ((HeapTuple) data)->t_len; + Size tuplelen; + memcpy(&tuplelen, &((HeapTuple) data)->t_len, sizeof(uint32)); change->data.tp.newtuple = ReorderBufferGetTupleBuf(rb, tuplelen - offsetof(HeapTupleHeaderData, t_bits)); --+HP7ph2BbKc20aGI Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --+HP7ph2BbKc20aGI--