pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent accidental linking of system-supplied copies of libpq.so 6+ messages / 1 participants [nested] [flat]
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-04-03 20:26 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-04-03 20:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. We were being careless in some places about the order of -L switches in link command lines, such that -L switches referring to external directories could come before those referring to directories within the build tree. This made it possible to accidentally link a system-supplied library, for example /usr/lib/libpq.so, in place of the one built in the build tree. Hilarity ensued, the more so the older the system-supplied library is. To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL and the main LDFLAGS variable, both of which are "recursively expanded" so that they can be incrementally adjusted by different makefiles. Establish a policy that -L switches for directories in the build tree must always be added to LDFLAGS_INTERNAL, while -L switches for external directories must always be added to LDFLAGS. This is sufficient to ensure a safe search order. For simplicity, we typically also put -l switches for the respective libraries into those same variables. (Traditional make usage would have us put -l switches into LIBS, but cleaning that up is a project for another day, as there's no clear need for it.) This turns out to also require separating SHLIB_LINK into two variables, SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which switches go into which variable. And likewise for PG_LIBS. Although this change might appear to affect external users of pgxs.mk, I think it doesn't; they shouldn't have any need to touch the _INTERNAL variables. In passing, tweak src/common/Makefile so that the value of CPPFLAGS recorded in pg_config lacks "-DFRONTEND" and the recorded value of LDFLAGS lacks "-L../../../src/common". Both of those things are mistakes, apparently introduced during prior code rearrangements, as old versions of pg_config don't print them. In general we don't want anything that's specific to the src/common subdirectory to appear in those outputs. This is certainly a bug fix, but in view of the lack of field complaints, I'm unsure whether it's worth the risk of back-patching. In any case it seems wise to see what the buildfarm makes of it first. Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/dddfc4cb2edcfa5497f5d50190a7fb046c51da16 Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/hstore_plperl/Makefile | 2 +- contrib/hstore_plpython/Makefile | 2 +- contrib/jsonb_plperl/Makefile | 2 +- contrib/jsonb_plpython/Makefile | 2 +- contrib/ltree_plpython/Makefile | 2 +- contrib/oid2name/Makefile | 2 +- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 3 ++- src/bin/initdb/Makefile | 2 +- src/bin/pg_basebackup/Makefile | 2 +- src/bin/pg_ctl/Makefile | 2 +- src/bin/pg_dump/Makefile | 2 +- src/bin/pg_rewind/Makefile | 2 +- src/bin/pg_upgrade/Makefile | 2 +- src/bin/pgbench/Makefile | 2 +- src/bin/psql/Makefile | 2 +- src/bin/scripts/Makefile | 2 +- src/common/Makefile | 8 ++++---- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- src/tools/findoidjoins/Makefile | 2 +- 32 files changed, 66 insertions(+), 49 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-07-09 21:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-07-09 21:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c74f48a4ec54c36b515f85a6b779a4751b7070b7 Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/hstore_plperl/Makefile | 2 +- contrib/hstore_plpython/Makefile | 2 +- contrib/ltree_plpython/Makefile | 2 +- contrib/oid2name/Makefile | 2 +- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 3 ++- src/bin/initdb/Makefile | 2 +- src/bin/pg_basebackup/Makefile | 2 +- src/bin/pg_ctl/Makefile | 2 +- src/bin/pg_dump/Makefile | 2 +- src/bin/pg_rewind/Makefile | 2 +- src/bin/pg_upgrade/Makefile | 2 +- src/bin/pgbench/Makefile | 2 +- src/bin/psql/Makefile | 2 +- src/bin/scripts/Makefile | 2 +- src/common/Makefile | 8 ++++---- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- src/tools/findoidjoins/Makefile | 2 +- 30 files changed, 64 insertions(+), 47 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-07-09 21:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-07-09 21:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ccc286da1d35b5d57a1e3322027905c00507d38f Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/hstore_plperl/Makefile | 8 +++++--- contrib/hstore_plpython/Makefile | 10 +++++---- contrib/ltree_plpython/Makefile | 10 +++++---- contrib/oid2name/Makefile | 2 +- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 3 ++- src/bin/pg_basebackup/Makefile | 7 ++++--- src/bin/pg_ctl/Makefile | 3 ++- src/bin/pg_dump/Makefile | 2 +- src/bin/pg_rewind/Makefile | 2 +- src/bin/pg_upgrade/Makefile | 2 +- src/bin/pgbench/Makefile | 2 +- src/bin/psql/Makefile | 2 +- src/bin/scripts/Makefile | 2 +- src/common/Makefile | 8 ++++---- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- src/tools/findoidjoins/Makefile | 2 +- 29 files changed, 81 insertions(+), 56 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-07-09 21:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-07-09 21:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6532ca57ad326d6ac9200eff3f93c3b036626bb6 Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/hstore_plperl/Makefile | 8 +++++--- contrib/hstore_plpython/Makefile | 10 +++++---- contrib/ltree_plpython/Makefile | 10 +++++---- contrib/oid2name/Makefile | 2 +- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 3 ++- src/bin/pg_basebackup/Makefile | 7 ++++--- src/bin/pg_config/Makefile | 2 +- src/bin/pg_ctl/Makefile | 3 ++- src/bin/pgbench/Makefile | 2 +- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- 23 files changed, 72 insertions(+), 47 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-07-09 21:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-07-09 21:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/dd4e836748cec3e361e3b52243137960557a000d Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/oid2name/Makefile | 2 +- contrib/pgbench/Makefile | 3 ++- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 2 +- src/bin/pg_basebackup/Makefile | 7 ++++--- src/bin/pg_config/Makefile | 2 +- src/bin/pg_ctl/Makefile | 3 ++- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- 20 files changed, 55 insertions(+), 36 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent accidental linking of system-supplied copies of libpq.so @ 2018-07-09 21:23 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-07-09 21:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the former before all of the latter. This turns out to fix a problem recently noted on buildfarm member peripatus, that we attempted to incorporate code from libpgport.a into a shared library. That will fail on platforms that are sticky about putting non-PIC code into shared libraries. (It's quite surprising we hadn't seen such failures before, since the code in question has been like that for a long time.) I think that peripatus' problem could have been fixed with just a subset of this patch; but since the previous issue of accidentally linking to the wrong copy of a Postgres shlib seems likely to bite people in the field, let's just back-patch the whole change. Now that commit dddfc4cb2 has survived some beta testing, I'm less afraid to back-patch it than I was at the time. This also fixes undesired inclusion of "-DFRONTEND" in pg_config's CPPFLAGS output (in 9.6 and up) and undesired inclusion of "-L../../src/common" in its LDFLAGS output (in all supported branches). Back-patch to v10 and older branches; this is already in v11. Discussion: https://postgr.es/m/20180704234304.bq2dxispefl65odz@ler-imac.local Branch ------ REL9_3_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f6f75539d24772126a975256b8df9f8d57b07851 Modified Files -------------- contrib/dblink/Makefile | 2 +- contrib/oid2name/Makefile | 2 +- contrib/pgbench/Makefile | 3 ++- contrib/postgres_fdw/Makefile | 2 +- contrib/spi/Makefile | 2 -- contrib/vacuumlo/Makefile | 2 +- src/Makefile.global.in | 25 +++++++++++++++-------- src/Makefile.shlib | 10 +++++++-- src/backend/replication/libpqwalreceiver/Makefile | 2 +- src/bin/pg_config/Makefile | 2 +- src/bin/pg_ctl/Makefile | 3 ++- src/interfaces/ecpg/compatlib/Makefile | 4 ++-- src/interfaces/ecpg/ecpglib/Makefile | 3 ++- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/ecpg/test/Makefile.regress | 5 +++-- src/interfaces/ecpg/test/compat_informix/Makefile | 3 +-- src/interfaces/libpq/test/Makefile | 4 ++-- src/makefiles/pgxs.mk | 4 +++- src/test/examples/Makefile | 4 ++-- 19 files changed, 51 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-07-09 21:23 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-04-03 20:26 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us> 2018-07-09 21:23 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us> 2018-07-09 21:23 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us> 2018-07-09 21:23 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us> 2018-07-09 21:23 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us> 2018-07-09 21:23 pgsql: Prevent accidental linking of system-supplied copies of libpq.so Tom Lane <tgl@sss.pgh.pa.us>
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