From d1eb509b4af3ff4a6d00c13670bdadfdfe863844 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Fri, 21 Dec 2012 10:59:11 -0600 Subject: [PATCH] device-mapper-multipath-0.4.9-42 Add 0034-RHBZ-887737-check-for-null-key.patch Add 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch * Compile multipathd with full RELRO and PIE and install to /usr --- 0034-RHBZ-887737-check-for-null-key.patch | 28 ++++ 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch | 148 ++++++++++++++++++ device-mapper-multipath.spec | 18 ++- 3 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 0034-RHBZ-887737-check-for-null-key.patch create mode 100644 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch diff --git a/0034-RHBZ-887737-check-for-null-key.patch b/0034-RHBZ-887737-check-for-null-key.patch new file mode 100644 index 0000000..5a1ae3e --- /dev/null +++ b/0034-RHBZ-887737-check-for-null-key.patch @@ -0,0 +1,28 @@ +--- + libmultipath/dict.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: multipath-tools-120821/libmultipath/dict.c +=================================================================== +--- multipath-tools-120821.orig/libmultipath/dict.c ++++ multipath-tools-120821/libmultipath/dict.c +@@ -2077,6 +2077,9 @@ snprint_mp_reservation_key (char * buff, + unsigned char *keyp; + uint64_t prkey = 0; + struct mpentry * mpe = (struct mpentry *)data; ++ ++ if (!mpe->reservation_key) ++ return 0; + keyp = (unsigned char *)mpe->reservation_key; + for (i = 0; i < 8; i++) { + if (i > 0) +@@ -2768,6 +2771,9 @@ snprint_def_reservation_key(char * buff, + int i; + unsigned char *keyp; + uint64_t prkey = 0; ++ ++ if (!conf->reservation_key) ++ return 0; + keyp = (unsigned char *)conf->reservation_key; + for (i = 0; i < 8; i++) { + if (i > 0) diff --git a/0035-RHBZ-883981-cleanup-rpmdiff-issues.patch b/0035-RHBZ-883981-cleanup-rpmdiff-issues.patch new file mode 100644 index 0000000..924375f --- /dev/null +++ b/0035-RHBZ-883981-cleanup-rpmdiff-issues.patch @@ -0,0 +1,148 @@ +--- + Makefile.inc | 9 +++++---- + kpartx/Makefile | 2 +- + libmpathpersist/Makefile | 4 ++-- + libmultipath/Makefile | 1 + + libmultipath/checkers/Makefile | 2 +- + libmultipath/prioritizers/Makefile | 2 +- + multipath/Makefile | 2 +- + multipathd/Makefile | 5 +++-- + 8 files changed, 15 insertions(+), 12 deletions(-) + +Index: multipath-tools-120821/Makefile.inc +=================================================================== +--- multipath-tools-120821.orig/Makefile.inc ++++ multipath-tools-120821/Makefile.inc +@@ -23,15 +23,15 @@ endif + + prefix = + exec_prefix = $(prefix) +-bindir = $(exec_prefix)/sbin ++bindir = $(exec_prefix)/usr/sbin + libudevdir = ${prefix}/lib/udev + multipathdir = $(TOPDIR)/libmultipath + mandir = $(prefix)/usr/share/man/man8 + man5dir = $(prefix)/usr/share/man/man5 + man3dir = $(prefix)/usr/share/man/man3 + rcdir = $(prefix)/etc/rc.d/init.d +-syslibdir = $(prefix)/$(LIB) +-libdir = $(prefix)/$(LIB)/multipath ++syslibdir = $(prefix)/usr/$(LIB) ++libdir = $(prefix)/usr/$(LIB)/multipath + unitdir = $(prefix)/lib/systemd/system + mpathpersistdir = $(TOPDIR)/libmpathpersist + +@@ -42,8 +42,9 @@ ifndef RPM_OPT_FLAGS + RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 + endif + ++LDFLAGS += -Wl,-z,relro + OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes +-CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" ++CFLAGS = $(OPTFLAGS) -DLIB_STRING=\"${LIB}\" + SHARED_FLAGS = -shared + + %.o: %.c +Index: multipath-tools-120821/multipathd/Makefile +=================================================================== +--- multipath-tools-120821.orig/multipathd/Makefile ++++ multipath-tools-120821/multipathd/Makefile +@@ -5,9 +5,10 @@ include ../Makefile.inc + # + # basic flags setting + # +-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) ++CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir) + LDFLAGS += -lpthread -ldevmapper -lreadline -lncurses -ludev -ldl \ +- -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist ++ -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \ ++ -Wl,-z,now -pie + + # + # debuging stuff +Index: multipath-tools-120821/kpartx/Makefile +=================================================================== +--- multipath-tools-120821.orig/kpartx/Makefile ++++ multipath-tools-120821/kpartx/Makefile +@@ -4,7 +4,7 @@ + # + include ../Makefile.inc + +-CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ++CFLAGS += -fPIC -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + + LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) + +Index: multipath-tools-120821/libmpathpersist/Makefile +=================================================================== +--- multipath-tools-120821.orig/libmpathpersist/Makefile ++++ multipath-tools-120821/libmpathpersist/Makefile +@@ -10,7 +10,7 @@ DEVLIB = libmpathpersist.so + LIBS = $(DEVLIB).$(SONAME) + + +-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir) ++CFLAGS += -fPIC -I$(multipathdir) -I$(mpathpersistdir) + LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath + + OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o +@@ -19,7 +19,7 @@ all: $(LIBS) + + + $(LIBS): +- $(CC) -Wall -fPIC -c $(CFLAGS) *.c ++ $(CC) -Wall -c $(CFLAGS) *.c + $(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) + ln -s $(LIBS) $(DEVLIB) + $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz +Index: multipath-tools-120821/libmultipath/Makefile +=================================================================== +--- multipath-tools-120821.orig/libmultipath/Makefile ++++ multipath-tools-120821/libmultipath/Makefile +@@ -8,6 +8,7 @@ SONAME=0 + DEVLIB = libmultipath.so + LIBS = $(DEVLIB).$(SONAME) + LIBDEPS = -lpthread -ldl -ldevmapper -ludev ++CFLAGS += -fPIC + + OBJS = memory.o parser.o vector.o devmapper.o \ + hwtable.o blacklist.o util.o dmparser.o config.o \ +Index: multipath-tools-120821/libmultipath/checkers/Makefile +=================================================================== +--- multipath-tools-120821.orig/libmultipath/checkers/Makefile ++++ multipath-tools-120821/libmultipath/checkers/Makefile +@@ -14,7 +14,7 @@ LIBS= \ + libcheckhp_sw.so \ + libcheckrdac.so + +-CFLAGS += -I.. ++CFLAGS += -fPIC -I.. + + all: $(LIBS) + +Index: multipath-tools-120821/libmultipath/prioritizers/Makefile +=================================================================== +--- multipath-tools-120821.orig/libmultipath/prioritizers/Makefile ++++ multipath-tools-120821/libmultipath/prioritizers/Makefile +@@ -17,7 +17,7 @@ LIBS = \ + libprioweightedpath.so \ + libprioiet.so + +-CFLAGS += -I.. ++CFLAGS += -fPIC -I.. + + all: $(LIBS) + +Index: multipath-tools-120821/multipath/Makefile +=================================================================== +--- multipath-tools-120821.orig/multipath/Makefile ++++ multipath-tools-120821/multipath/Makefile +@@ -6,7 +6,7 @@ include ../Makefile.inc + + OBJS = main.o + +-CFLAGS += -I$(multipathdir) ++CFLAGS += -fPIC -I$(multipathdir) + LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath + + EXEC = multipath diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 2bf6f15..64195b7 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,7 +1,7 @@ Summary: Tools to manage multipath devices using device-mapper Name: device-mapper-multipath Version: 0.4.9 -Release: 41%{?dist} +Release: 42%{?dist} License: GPL+ Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -41,6 +41,8 @@ Patch0030: 0030-RH-early-blacklist.patch Patch0031: 0031-RHBZ-882060-fix-null-strncmp.patch Patch0032: 0032-RH-make-path-fd-readonly.patch Patch0033: 0033-RH-dont-disable-libdm-failback-for-sync-case.patch +Patch0034: 0034-RHBZ-887737-check-for-null-key.patch +Patch0035: 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -126,11 +128,13 @@ kpartx manages partition creation and removal for device-mapper devices. %patch0031 -p1 %patch0032 -p1 %patch0033 -p1 +%patch0034 -p1 +%patch0035 -p1 cp %{SOURCE1} . %build -%define _sbindir /sbin -%define _libdir /%{_lib} +%define _sbindir /usr/sbin +%define _libdir /usr/%{_lib} %define _libmpathdir %{_libdir}/multipath make %{?_smp_mflags} LIB=%{_lib} @@ -146,7 +150,6 @@ make install \ unitdir=%{_unitdir} # tree fix up -# install -m 0644 %{SOURCE1} %{buildroot}/etc/multipath.conf install -d %{buildroot}/etc/multipath %clean @@ -213,10 +216,15 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||: %files -n kpartx %defattr(-,root,root,-) -/sbin/kpartx +%{_sbindir}/kpartx %{_mandir}/man8/kpartx.8.gz %changelog +* Fri Dec 21 2012 Benjamin Marzinski 0.4.9-42 +- Add 0034-RHBZ-887737-check-for-null-key.patch +- Add 0035-RHBZ-883981-cleanup-rpmdiff-issues.patch + * Compile multipathd with full RELRO and PIE and install to /usr + * Mon Dec 17 2012 Benjamin Marzinski 0.4.9-41 - Add 0033-RH-dont-disable-libdm-failback-for-sync-case.patch * make kpartx -s and multipath use libdm failback device creation, so