From 31786f0fda80946dbc268945871f7368b1fb253d Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Fri, 13 Sep 2013 17:03:29 -0700 Subject: [PATCH] fix iscsiuio hardened build and other compiler flags The new iscsiuio code sets CFLAGS in configure.ac, wiping out the environment setup by rpm. Patch that out. Run configure for iscsiuio and open-isns from rpm, otherwise the toplevel makefile will configure them without any arguments. Also fix local build when iscsi-initiator-utils is installed, but having the check to prevent overwriting configuration files during install look in DESTDIR. --- 0065-fix-hardened-build-of-iscsiuio.patch | 62 +++++++++++++++++++ ...ion-string-to-match-RPM-package-vers.patch | 2 +- iscsi-initiator-utils.spec | 20 +++++- 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 0065-fix-hardened-build-of-iscsiuio.patch diff --git a/0065-fix-hardened-build-of-iscsiuio.patch b/0065-fix-hardened-build-of-iscsiuio.patch new file mode 100644 index 0000000..9a5c8f6 --- /dev/null +++ b/0065-fix-hardened-build-of-iscsiuio.patch @@ -0,0 +1,62 @@ +From 436ac9074def43ae09d7ecc28eec6cdc77a9d0e2 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Fri, 13 Sep 2013 16:56:51 -0700 +Subject: [PATCH 65/65] fix hardened build of iscsiuio + +The new iscsiuio code sets CFLAGS in configure.ac, wiping out the +environment setup by rpm. Patch that out. + +Also fix local build when iscsi-initiator-utils is installed, but having +the check to prevent overwriting configuration files during install look +in DESTDIR. +--- + Makefile | 2 +- + iscsiuio/configure | 2 +- + iscsiuio/configure.ac | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + mode change 100644 => 100755 iscsiuio/configure + +diff --git a/Makefile b/Makefile +index 02346bf..172d30e 100644 +--- a/Makefile ++++ b/Makefile +@@ -123,7 +123,7 @@ install_iface: $(IFACEFILES) + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces + + install_etc: $(ETCFILES) +- if [ ! -f /etc/iscsi/iscsid.conf ]; then \ ++ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/iscsid.conf ]; then \ + $(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \ + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \ + fi +diff --git a/iscsiuio/configure b/iscsiuio/configure +old mode 100644 +new mode 100755 +index 2740598..cd13f92 +--- a/iscsiuio/configure ++++ b/iscsiuio/configure +@@ -21288,7 +21288,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + +-CFLAGS="-O2 -Wall" ++CFLAGS="${CFLAGS} -O2 -Wall" + ## check for --enable-debug first before checking CFLAGS before + ## so that we don't mix -O and -g + # Check whether --enable-debug or --disable-debug was given. +diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac +index e9a5e32..d9a6bdb 100644 +--- a/iscsiuio/configure.ac ++++ b/iscsiuio/configure.ac +@@ -52,7 +52,7 @@ AC_LIBTOOL_DLOPEN + # libtool stuff + AC_PROG_LIBTOOL + +-CFLAGS="-O2 -Wall" ++CFLAGS="${CFLAGS} -O2 -Wall" + ## check for --enable-debug first before checking CFLAGS before + ## so that we don't mix -O and -g + AC_ARG_ENABLE(debug, +-- +1.8.1.4 + diff --git a/0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch b/0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch index 4fd2bd8..c6398b1 100644 --- a/0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +++ b/0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -16,7 +16,7 @@ index a090522..aef0c3d 100644 * some other maintainer could merge a patch without going through us */ -#define ISCSI_VERSION_STR "2.0-873" -+#define ISCSI_VERSION_STR "6.2.0.873-12" ++#define ISCSI_VERSION_STR "6.2.0.873-14" #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" #endif diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index adb128d..35a8544 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -4,7 +4,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.%{open_iscsi_version}.%{open_iscsi_build} -Release: 13%{?dist} +Release: 14%{?dist} Group: System Environment/Daemons License: GPLv2+ URL: http://www.open-iscsi.org @@ -63,6 +63,7 @@ Patch61: 0061-resolve-565245-multilib-issues-caused-by-doxygen.patch Patch62: 0062-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch Patch63: 0063-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch Patch64: 0064-libiscsi-fix-incorrect-strncpy-use.patch +Patch65: 0065-fix-hardened-build-of-iscsiuio.patch # version string, needs to be updated with each build Patch99: 0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -142,11 +143,23 @@ developing applications that use %{name}. %patch62 -p1 %patch63 -p1 %patch64 -p1 +%patch65 -p1 # version string %patch99 -p1 + %build -chmod +x iscsiuio/configure + +# configure sub-packages from here +# letting the top level Makefile do it will lose setting from rpm +cd iscsiuio +chmod +x configure +%{configure} +cd .. +cd utils/open-isns +%{configure} +cd ../.. + make OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod" pushd libiscsi python setup.py build @@ -278,6 +291,9 @@ fi %{_includedir}/libiscsi.h %changelog +* Fri Sep 13 2013 Chris Leech - 6.2.0.873-14 +- fix iscsiuio hardened build and other compiler flags + * Fri Aug 23 2013 Andy Grover - 6.2.0.873-13 - Fix patch 0041 to check session != NULL before calling iscsi_sysfs_read_boot()