Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1zka-0005Uc-IE for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Nov 2016 17:55: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 1c1zkY-0002N5-SK for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Nov 2016 17:54:58 +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 1c1zkV-0002LX-Tz for pgsql-hackers@postgresql.org; Wed, 02 Nov 2016 17:54:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c1zkT-0001NQ-Hq for pgsql-hackers@postgresql.org; Wed, 02 Nov 2016 17:54:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uA2HslO9008922; Wed, 2 Nov 2016 13:54:47 -0400 From: Tom Lane To: Peter Eisentraut cc: Jesper Pedersen , Michael Paquier , Ashutosh Sharma , Jeff Janes , Alvaro Herrera , PostgreSQL Hackers Subject: Re: pageinspect: Hash index support In-reply-to: <02dc6cef-a80c-c976-8ac0-518ff9b22dd8@2ndquadrant.com> References: <5d64a536-cc90-ce96-b68f-5b6bd3206476@redhat.com> <80a00b5c-56d3-dffb-8dba-edf5d2167b12@2ndquadrant.com> <16d89e7e-cb1a-cb5d-e944-6f10c324a312@redhat.com> <836487ee-8d4e-cd49-54ac-f4793ddba5ae@redhat.com> <8a751498-6ee9-b943-abf3-b5641851d7de@2ndquadrant.com> <62ee2eba-3a5b-06d3-e224-cfe00b395be7@redhat.com> <66afc31d-e97a-41c3-da4c-bfa02fa2d54e@redhat.com> <02dc6cef-a80c-c976-8ac0-518ff9b22dd8@2n! dquadrant.com> Comments: In-reply-to Peter Eisentraut message dated "Wed, 02 Nov 2016 13:42:49 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8920.1478109287.1@sss.pgh.pa.us> Date: Wed, 02 Nov 2016 13:54:47 -0400 Message-ID: <8921.1478109287@sss.pgh.pa.us> X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Peter Eisentraut writes: > So, we're down to crashes in gin_metapage_info() on ia64 and sparc64. > My guess is that the raw page data that is passed into the function > needs to be 8-byte aligned before being accessed as GinMetaPageData. That's what it looks like to me, too. The "bytea" page image is guaranteed to be improperly aligned for 64-bit access, since it will have an int32 length word before the actual page data, breaking the alignment that would exist for a page sitting in a page buffer. This is likely to be a problem for more things than just gin_metapage_info(); sooner or later it could affect just about everything in pageinspect. > (Maybe GinPageGetMeta() should do it?) I think the right thing is likely to be to copy the presented bytea into a palloc'd (and therefore properly aligned) buffer. And not just in this one function. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers