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: Ensure proper alignment of tuples in HashMemoryChunkData buffers
Date: Wed, 03 Jan 2018 02:23:22 +0000
Message-ID: <E1eWYiA-0001Tq-DI@gemulon.postgresql.org> (raw)

Ensure proper alignment of tuples in HashMemoryChunkData buffers.

The previous coding relied (without any documentation) on the data[]
member of HashMemoryChunkData being at a MAXALIGN'ed offset.  If it
was not, the tuples would not be maxaligned either, leading to failures
on alignment-picky machines.  While there seems to be no live bug on any
platform we support, this is clearly pretty fragile: any addition to or
rearrangement of the fields in HashMemoryChunkData could break it.
Let's remove the hazard by getting rid of the data[] member and instead
using pointer arithmetic with an explicitly maxalign'ed offset.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5dc692f78d3bee1e86d095a9e8d9242b44f78b01

Modified Files
--------------
src/backend/executor/nodeHash.c | 34 +++++++++++++++-------------------
src/include/executor/hashjoin.h | 12 +++++++++---
2 files changed, 24 insertions(+), 22 deletions(-)



Message-ID: <E1eWYiA-0001Tq-DI@gemulon.postgresql.org>
Permalink:  ../E1eWYiA-0001Tq-DI@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eWYiA-0001Tq-DI@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: Ensure proper alignment of tuples in HashMemoryChunkData buffers
  In-Reply-To: <E1eWYiA-0001Tq-DI@gemulon.postgresql.org>
  References: <E1eWYiA-0001Tq-DI@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