From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Install a check for mis-linking of src/port and src/common funct
Date: Sun, 09 Sep 2018 16:23:33 +0000
Message-ID: <E1fz2Un-0004eK-Ka@gemulon.postgresql.org> (raw)
Install a check for mis-linking of src/port and src/common functions.
On ELF-based platforms (and maybe others?) it's possible for a shared
library, when dynamically loaded into the backend, to call the backend
versions of src/port and src/common functions rather than the frontend
versions that are actually linked into the shlib. This is definitely
not what we want, because the frontend versions often behave slightly
differently. Up to now it's been "slight" enough that nobody noticed;
but with the addition of SCRAM support functions in src/common, we're
observing crashes due to the difference between palloc and malloc
memory allocation rules, as reported in bug #15367 from Jeremy Evans.
The purpose of this patch is to create a direct test for this type of
mis-linking, so that we know whether any given platform requires extra
measures to prevent using the wrong functions. If the test fails, it
will lead to connection failures in the contrib/postgres_fdw regression
test. At the moment, *BSD platforms using ELF format are known to have
the problem and can be expected to fail; but we need to know whether
anything else does, and we need a reliable ongoing check for future
platforms.
Actually fixing the problem will be the subject of later commit(s).
Discussion: https://postgr.es/m/153626613985.23143.4743626885618266803@wrigleys.postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ed0cdf0e05134d1084b01bf8a77e9e1dc5081f91
Modified Files
--------------
src/backend/bootstrap/bootstrap.c | 8 ++++++++
src/common/Makefile | 3 ++-
src/common/link-canary.c | 36 ++++++++++++++++++++++++++++++++++++
src/include/common/link-canary.h | 17 +++++++++++++++++
src/interfaces/libpq/.gitignore | 1 +
src/interfaces/libpq/Makefile | 6 +++---
src/interfaces/libpq/fe-connect.c | 14 ++++++++++++++
src/tools/msvc/Mkvcbuild.pm | 3 ++-
8 files changed, 83 insertions(+), 5 deletions(-)
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: Install a check for mis-linking of src/port and src/common funct
In-Reply-To: <E1fz2Un-0004eK-Ka@gemulon.postgresql.org>
References: <E1fz2Un-0004eK-Ka@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