From 8e9ad7bb5117edea4df08cd9a2de62685103a4b3 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Mon, 19 Mar 2018 23:38:45 +0100 Subject: [PATCH 1/4] postgresql: clean up CFLAGS - The extra include is removed; the postgresql build system adds this include by itself. - '-lpthread' is removed; the postgresql build system is able to detect how to access pthread features by itself. - '$(FPIC)' is removed; adding this to CFLAGS is not recommendable: a) The postgresql build system adds its own PIC flag behind OpenWrt's CFLAGS when compiling shared objects, overriding OpenWrt's setting. b) Forcing applications into PIC mode will just slow them down. c) This leads to build failures on aarch64: access/transam/commit_ts.o: In function `CommitTsPagePrecedes': commit_ts.c:(.text+0x14): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `TransactionIdPrecedes' defined in .text section in access/transam/transam.o commit_ts.c:(.text+0x14): warning: Too many GOT entries for -fpic, please recompile with -fPIC /var/lib/buildbot/slaves/dave-builder/aarch64_generic/build/sdk/staging_dir/toolchain-aarch64_generic_gcc-7.3.0_musl/bin/../lib/gcc/aarch64-openwrt-linux-musl/7.3.0/../../../../aarch64-openwrt-linux-musl/bin/ld: final link failed: Symbol needs debug section which does not exist collect2: error: ld returned 1 exit status Signed-off-by: Sebastian Kemper --- libs/postgresql/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libs/postgresql/Makefile b/libs/postgresql/Makefile index 19932fb06f..b3b3e84e74 100644 --- a/libs/postgresql/Makefile +++ b/libs/postgresql/Makefile @@ -155,8 +155,6 @@ CONFIGURE_ARGS += \ --enable-depend \ $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) -EXTRA_CFLAGS:= -I$(PKG_BUILD_DIR)/src/include/ - # Need a native ecpg, pg_config and zic for build define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)" @@ -179,8 +177,6 @@ define Build/Configure $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress endef -TARGET_CFLAGS += $(FPIC) -lpthread - # because PROFILE means something else in the project Makefile unexport PROFILE From 74d15bdb9832e7cc2c47930d84c042d0e54a7d81 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Mon, 19 Mar 2018 23:49:14 +0100 Subject: [PATCH 2/4] postgresql: clean up DEPENDS Currently the DEPENDS do not reflect reality. Fix this. Signed-off-by: Sebastian Kemper --- libs/postgresql/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/postgresql/Makefile b/libs/postgresql/Makefile index b3b3e84e74..f10d7b8642 100644 --- a/libs/postgresql/Makefile +++ b/libs/postgresql/Makefile @@ -30,7 +30,7 @@ include $(INCLUDE_DIR)/package.mk define Package/libpq SECTION:=libs CATEGORY:=Libraries - DEPENDS:=+zlib +libreadline +libpthread +libncursesw + DEPENDS:=+libpthread TITLE:=PostgreSQL client library URL:=http://www.postgresql.org/ SUBMENU:=database @@ -43,7 +43,7 @@ endef define Package/pgsql-cli SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+libpq +librt + DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib TITLE:=Command Line Interface (CLI) to PostgreSQL databases URL:=http://www.postgresql.org/ SUBMENU:=database @@ -56,7 +56,7 @@ endef define Package/pgsql-cli-extra SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+libpq +librt + DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib TITLE:=Command Line extras for PostgreSQL databases URL:=http://www.postgresql.org/ SUBMENU:=database @@ -69,7 +69,7 @@ endef define Package/pgsql-server SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+libpq +librt +pgsql-cli + DEPENDS:=+pgsql-cli TITLE:=PostgreSQL databases Server URL:=http://www.postgresql.org/ SUBMENU:=database From be07e031d04e5cab26856f1b5b5c2572f34ebb7b Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Mon, 19 Mar 2018 23:51:04 +0100 Subject: [PATCH 3/4] postgresql: fix build for ARC arch When building for ARC the compile fails with: /var/lib/buildbot/slaves/dave-builder/arc_arc700/build/sdk/build_dir/target-arc_arc700_uClibc/postgresql-9.6.5/src/include/storage/s_lock.h:899:2: error: #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@postgresql.org. #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@postgresql.org. So disable spinlocks when compiling for this arch. This was done likewise for the avr32 target, which is not supported anymore, so this can be deleted. Signed-off-by: Sebastian Kemper --- libs/postgresql/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/postgresql/Makefile b/libs/postgresql/Makefile index f10d7b8642..277c3022e8 100644 --- a/libs/postgresql/Makefile +++ b/libs/postgresql/Makefile @@ -153,7 +153,7 @@ CONFIGURE_ARGS += \ --without-tcl \ --with-zlib="yes" \ --enable-depend \ - $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) + $(if $(CONFIG_arc),--disable-spinlocks) # Need a native ecpg, pg_config and zic for build define Host/Compile From b86d9028d1799113248dc47759746d32516e72f4 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Mon, 19 Mar 2018 23:56:58 +0100 Subject: [PATCH 4/4] postgresql: update to version 9.6.8 This update addresses: CVE-2018-1052 CVE-2018-1053 CVE-2018-1058 Signed-off-by: Sebastian Kemper --- libs/postgresql/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/postgresql/Makefile b/libs/postgresql/Makefile index 277c3022e8..e9fe9ea789 100644 --- a/libs/postgresql/Makefile +++ b/libs/postgresql/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=postgresql -PKG_VERSION:=9.6.6 +PKG_VERSION:=9.6.8 PKG_RELEASE:=1 PKG_MAINTAINER:=Daniel Golle PKG_LICENSE:=PostgreSQL @@ -16,7 +16,7 @@ PKG_SOURCE_URL:=\ http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \ ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION) -PKG_HASH:=399cdffcb872f785ba67e25d275463d74521566318cfef8fe219050d063c8154 +PKG_HASH:=eafdb3b912e9ec34bdd28b651d00226a6253ba65036cb9a41cad2d9e82e3eb70 PKG_USE_MIPS16:=0 PKG_FIXUP:=autoreconf