pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix shm_toc.c to always return buffer-aligned memory.
Date: Wed, 16 Aug 2017 18:56:58 +0000
Message-ID: <E1di3Uw-0000Us-K9@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix shm_toc.c to always return buffer-aligned memory.

Previously, if you passed a non-aligned size to shm_toc_create(), the
memory returned by shm_toc_allocate() would be similarly non-aligned.
This was exposed by commit 3cda10f41b, which allocated structs containing
a pg_atomic_uint64 field with shm_toc_allocate(). On systems with
MAXIMUM_ALIGNOF = 4, such structs still need to be 8-bytes aligned, but
the memory returned by shm_toc_allocate() was only 4-bytes aligned.

It's quite bogus that we abuse BUFFERALIGN to align the structs for
pg_atomic_uint64. It doesn't really have anything to do with buffers. But
that's a separate issue.

This ought to fix the buildfarm failures on 32-bit x86 systems.

Discussion: https://www.postgresql.org/message-id/7e0a73a5-0df9-1859-b8ae-9acf122dc38d@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ac883ac453e9c479f397780918f235c440b7a02f

Modified Files
--------------
src/backend/storage/ipc/shm_toc.c | 24 +++++++++++++++++++-----
src/include/c.h                   |  1 +
2 files changed, 20 insertions(+), 5 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: <E1di3Uw-0000Us-K9@gemulon.postgresql.org>
Permalink:  ../E1di3Uw-0000Us-K9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1di3Uw-0000Us-K9@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: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Fix shm_toc.c to always return buffer-aligned memory.
  In-Reply-To: <E1di3Uw-0000Us-K9@gemulon.postgresql.org>
  References: <E1di3Uw-0000Us-K9@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