pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: In pageinspect/hashfuncs.c, avoid crashes on alignment-picky mac
Date: Fri, 03 Feb 2017 16:35:03 +0000
Message-ID: <E1cZgpD-00072p-Ok@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

In pageinspect/hashfuncs.c, avoid crashes on alignment-picky machines.

On machines with MAXALIGN = 8, the payload of a bytea is not maxaligned,
since it will start 4 bytes into a palloc'd value.  On alignment-picky
hardware, this will cause failures in accesses to 8-byte-wide values
within the page.  We already encountered this problem when we introduced
GIN index inspection functions, and fixed it in commit 84ad68d64.  Make
use of the same function for hash indexes.

A small difficulty is that up to now contrib/pageinspect has not shared
any functions at all across files.  To support that, introduce a common
header file "pageinspect.h" for the module.

Also, move get_page_from_raw() out of ginfuncs.c, where it didn't
especially belong, and put it in rawpage.c which seems a more natural home.

Per buildfarm.

Discussion: https://postgr.es/m/17311.1486134714@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/14e9b18fed289e483ed28daec60fdab95da9cc48

Modified Files
--------------
contrib/pageinspect/brinfuncs.c   |  2 ++
contrib/pageinspect/btreefuncs.c  |  2 ++
contrib/pageinspect/fsmfuncs.c    |  2 ++
contrib/pageinspect/ginfuncs.c    | 22 ++--------------------
contrib/pageinspect/hashfuncs.c   | 18 ++++--------------
contrib/pageinspect/heapfuncs.c   |  2 ++
contrib/pageinspect/pageinspect.h | 21 +++++++++++++++++++++
contrib/pageinspect/rawpage.c     | 38 ++++++++++++++++++++++++++++++++++++++
8 files changed, 73 insertions(+), 34 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cZgpD-00072p-Ok@gemulon.postgresql.org>
Permalink:  ../E1cZgpD-00072p-Ok@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cZgpD-00072p-Ok@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: In pageinspect/hashfuncs.c, avoid crashes on alignment-picky mac
  In-Reply-To: <E1cZgpD-00072p-Ok@gemulon.postgresql.org>
  References: <E1cZgpD-00072p-Ok@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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