Commit abfbc911 authored by Leonardo Arena's avatar Leonardo Arena

main/multipath-tools: upgrade to 0.4.9_git20120127

Upstream is lazy in making releases. Used the same git snapshot used in current Debian stable.
parent 73e5eb1a
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname="multipath-tools"
pkgver=0.4.9
pkgrel=6
pkgver=0.4.9_git20120127
pkgrel=0
pkgdesc="Device Mapper Multipathing Driver"
url="http://christophe.varoqui.free.fr/"
arch="all"
......@@ -10,23 +10,20 @@ depends="udev"
makedepends="lvm2-dev libaio-dev readline-dev ncurses-dev"
install=
subpackages="$pkgname-doc"
source="http://christophe.varoqui.free.fr/$pkgname/$pkgname-$pkgver.tar.bz2
multipath-tools-0.4.9-build.patch
multipath-tools-0.4.8-kparted-ext-partitions.patch
multipath-tools-0.4.9-log_enquery_overflow.patch
multipath-tools-0.4.9-buffer-overflows.patch
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
"
#source="http://christophe.varoqui.free.fr/$pkgname/$pkgname-$pkgver.tar.bz2
_builddir="$srcdir"
prepare() {
cd $_builddir
find . -name Makefile -exec sed -i -e 's/glibc/uclibc/g' {} \;
for i in ../*.patch
do
msg "Applying $i"
patch -p1 < $i || return 1
done
# for i in ../*.patch
# do
# msg "Applying $i"
# patch -p1 < $i || return 1
# done
}
build() {
......@@ -45,18 +42,6 @@ package() {
install -D -m755 ../$pkgname.initd $pkgdir/etc/init.d/multipathd
}
md5sums="a6d4b48afc28f1f50f5ee4b1b06d2765 multipath-tools-0.4.9.tar.bz2
751a7e079fef26cced73e2fc31ad7f11 multipath-tools-0.4.9-build.patch
68ea053e02e9f5c4883b24b3f9bb2bf1 multipath-tools-0.4.8-kparted-ext-partitions.patch
00eae05e02f1b85062e998574ab1b833 multipath-tools-0.4.9-log_enquery_overflow.patch
c5aab36777b0304a3525533cdd31bddc multipath-tools-0.4.9-buffer-overflows.patch"
sha256sums="8d44c8815144b5589cc3e604cb3fc16c76a028aef08aa1bec334ff70bf9ac712 multipath-tools-0.4.9.tar.bz2
004678610d0468c6d7be7ac5238b1162d41bf0a6e4423932ba503786650e5448 multipath-tools-0.4.9-build.patch
4cd2e75782dbaba715b85ef1ececdc130e24d7497897ceea9802c779e79c1c73 multipath-tools-0.4.8-kparted-ext-partitions.patch
43cedfbfdc1a5636e107bc3d388f0b03185b12761c3abb18424352f516d72b4b multipath-tools-0.4.9-log_enquery_overflow.patch
1f9ca1d26fee69dc7d5c1b65a835d23e1b8dd8de6fd3678faf3e7b499611d15d multipath-tools-0.4.9-buffer-overflows.patch"
sha512sums="ff4d74951b4ca6f95deb501876e5edec00b6880c98bd3f24452133c142a4118f186a5988e08151ecf5dc7348568eb434be19c31ee5257c5372997f44003eb540 multipath-tools-0.4.9.tar.bz2
123987a6da27234ab56d3301a22d392a752191a54d16bd78e301bd39dc7d39f777def9d141b3786e29626a1c503763d56d8f6233698ac470f55f9d508009b72b multipath-tools-0.4.9-build.patch
9cce969e9e1a7816356fa2b624cae5f71b4291cd3383ca462a98bf6b68aa9111f8bb42d3105697746eced52a29ed4fb006957ccbda77d04da31a179715c64ff8 multipath-tools-0.4.8-kparted-ext-partitions.patch
acbdb4fc901acd8473b3dca2d0fe0b622d240c0ae02f4dda16bbb0d847f1fe05a849ec1916df1916e2c5f398cbf21b9c9f1c7b09429f3ee3ca6ea78d6996e1d3 multipath-tools-0.4.9-log_enquery_overflow.patch
5d17c452868d8e01ea171a4e734aeecc837d959d55a17de051ba006f1980d3b8c84f7d0d0db4f22c1c3f741ed074a1377a5ae8d8534f956e16b904ee1ee382aa multipath-tools-0.4.9-buffer-overflows.patch"
md5sums="38503d19b66c247c7da87eca9a48d570 multipath-tools-0.4.9_git20120127.tar.gz"
sha256sums="bc51ed7cae3fd4a60d5157d7fb3593395663362223e5fd86f30cf4b6d92f9cf4 multipath-tools-0.4.9_git20120127.tar.gz"
sha512sums="f9f27dded1d8c7fb7f1aae0d0febc0461cc939db337c204310d9d45a2d1d138601621cb56b5048f1a4b8a08142245b852d28ed6fddbd43d6466f41c67d933a9e multipath-tools-0.4.9_git20120127.tar.gz"
From c421c9282791696264d1333fb2552835140354c3 Mon Sep 17 00:00:00 2001
From: Robin H. Johnson <robbat2@gentoo.org>
Date: Thu, 5 Nov 2009 03:44:12 +0000
Subject: [PATCH] kpartx: Fix broken calculation of extended partitions that caused random devices to be used instead of the correct parent device.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
kpartx/dos.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/kpartx/dos.c b/kpartx/dos.c
index 1691105..317fc56 100644
--- a/kpartx/dos.c
+++ b/kpartx/dos.c
@@ -53,7 +53,9 @@ read_extended_partition(int fd, struct partition *ep, int en,
if (n < ns) {
sp[n].start = here + le32_to_cpu(p.start_sect);
sp[n].size = le32_to_cpu(p.nr_sects);
- sp[n].container = en + 1;
+ // This line seems to have no understandable
+ // purpose, and causes the wrong device to be used
+ //sp[n].container = en + 1;
n++;
} else {
fprintf(stderr,
--
1.6.4
--- multipath-tools-0.4.9.orig/libmultipath/prioritizers/datacore.c 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/libmultipath/prioritizers/datacore.c 2010-11-28 12:22:12.037228583 -0800
@@ -94,7 +94,7 @@
if ((io_hdr.info & SG_INFO_OK_MASK) != SG_INFO_OK)
return 0;
- snprintf(vendor, 9, "%.8s\n", inqBuffp + 8);
+ snprintf(vendor, 8, "%.8s\n", inqBuffp + 8);
snprintf(product, 17, "%.16s", inqBuffp + 16);
snprintf(luname, 21, "%.19s", inqBuffp + 36);
snprintf(wwpn, 17, "%.16s", inqBuffp + 96);
--- multipath-tools-0.4.9.orig/libmultipath/prioritizers/hds.c 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/libmultipath/prioritizers/hds.c 2010-11-28 12:22:44.199483997 -0800
@@ -123,7 +123,7 @@
return -1;
}
- snprintf (vendor, 9, "%.8s", inqBuffp + 8);
+ snprintf (vendor, 8, "%.8s", inqBuffp + 8);
snprintf (product, 17, "%.16s", inqBuffp + 16);
snprintf (serial, 5, "%.4s", inqBuffp + 40);
snprintf (ldev, 5, "%.4s", inqBuffp + 44);
--- multipath-tools-0.4.9.orig/kpartx/Makefile 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/kpartx/Makefile 2010-10-22 00:48:25.615627572 -0700
@@ -6,7 +6,7 @@
CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-LDFLAGS = -ldevmapper
+LIBS = -ldevmapper
OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
gpt.o mac.o crc32.o lopart.o xstrncpy.o devmapper.o
EXEC = kpartx
@@ -14,8 +14,7 @@
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(EXEC)
install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
@@ -23,13 +22,14 @@
$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/66-kpartx.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
+ rm -f $(DESTDIR)$(mandir)/$(EXEC).8
+ rm -f $(DESTDIR)/etc/udev/rules.d/66-kpartx.rules
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
--- multipath-tools-0.4.9.orig/Makefile.inc 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/Makefile.inc 2010-10-21 23:51:12.768868148 -0700
@@ -32,11 +32,10 @@
syslibdir = $(prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
-GZIP = /bin/gzip -9 -c
INSTALL_PROGRAM = install
-OPTFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
-CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\"
+OPTFLAGS = -Wall -Wunused -Wstrict-prototypes
+CFLAGS += $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\"
SHARED_FLAGS = -shared
%.o: %.c
--- multipath-tools-0.4.9.orig/multipath/Makefile 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/multipath/Makefile 2010-10-22 00:47:13.952010117 -0700
@@ -7,32 +7,30 @@
OBJS = main.o
CFLAGS += -I$(multipathdir)
-LDFLAGS += -lpthread -ldevmapper -ldl -lmultipath -L$(multipathdir)
+LIBS = -lpthread -ldevmapper -ldl -lmultipath -L$(multipathdir)
EXEC = multipath
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
- $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(EXEC)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/65-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
uninstall:
- rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
- rm $(DESTDIR)$(bindir)/$(EXEC)
- rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
- rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
+ rm -f $(DESTDIR)/etc/udev/rules.d/65-multipath.rules
+ rm -f $(DESTDIR)$(bindir)/$(EXEC)
+ rm -f $(DESTDIR)$(mandir)/$(EXEC).8
+ rm -f $(DESTDIR)$(man5dir)/$(EXEC).conf.5
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
--- multipath-tools-0.4.9.orig/multipathd/Makefile 2010-05-22 05:01:58.000000000 -0700
+++ multipath-tools-0.4.9/multipathd/Makefile 2010-10-22 00:48:02.502428428 -0700
@@ -6,7 +6,7 @@
# basic flags setting
#
CFLAGS += -I$(multipathdir)
-LDFLAGS += -lpthread -ldevmapper -lreadline -lncurses -ldl \
+LIBS += -lpthread -ldevmapper -lreadline -lncurses -ldl \
-lmultipath -L$(multipathdir)
#
@@ -28,21 +28,20 @@
all : $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $(EXEC) $(OBJS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(EXEC)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
rm -f $(DESTDIR)$(rcdir)/$(EXEC)
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
+ rm -f $(DESTDIR)$(mandir)/$(EXEC).8
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
From e1d69df0cdd1627676501df3a533b25ffadaeff0 Mon Sep 17 00:00:00 2001
From: Arkadiusz Miskiewicz <arekm@maven.pl>
Date: Sat, 27 Nov 2010 19:21:21 +0100
Subject: [PATCH] multipath-tools overflow
On Saturday 27 of November 2010, you wrote:
[...]
> the whole logarea is memset to 0 by logarea_init(), and each dequeued
> message is also memset to 0 by log_dequeue(), so it seems normal that
> msg->str value is 0x0, but it's really its address that matters.
Ok, got it. Pointers, memory areas in my debugging session - are looking
good then.
>
> It's not clear to me : are you actually hitting a bug or is it your
> debug session that puzzles you ?
I'm hitting a bug. multipathd dies for me at that strcpy(). Now I think
the bug is strcpy usage instead of memcpy because I'm building with
-O2 -D_FORTIFY_SOURCE=2 which turns on special glibc overflow
detection.
That detection seem to be smart enough to know that &str area is not
a string memory and aborts the program.
Found similar problem discussed here
http://sourceware.org/ml/binutils/2005-11/msg00308.html
glibc aborts the program:
[pid 13432] writev(2, [{"*** ", 4}, {"buffer overflow detected", 24},
{" ***: ", 6}, {"/home/users/arekm/rpm/BUILD/multipath-tools-0.4.9
/multipathd/multipathd", 71}, {" terminated\n", 12}], 5) = 117
same for valgrind:
**13436** *** strcpy_chk: buffer overflow detected ***: program terminated
==13436== at 0x4024997: VALGRIND_PRINTF_BACKTRACE (valgrind.h:4477)
==13436== by 0x40265F8: __strcpy_chk (mc_replace_strmem.c:781)
==13436== by 0x40EDC06: log_enqueue (string3.h:107)
==13436== by 0x40ED68A: log_safe (log_pthread.c:24)
==13436== by 0x40E296A: dlog (debug.c:36)
==13436== by 0x804ECEC: pidfile_create (pidfile.c:37)
==13436== by 0x804E731: main (main.c:1424)
The bug is not visible if I run multipathd in debug mode (-d).
This patch fixes the problem for me by avoiding false positive on strcpy_chk.
---
libmultipath/log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libmultipath/log.c b/libmultipath/log.c
index e56e46b..57b7696 100644
--- a/libmultipath/log.c
+++ b/libmultipath/log.c
@@ -142,7 +142,7 @@ int log_enqueue (int prio, const char * fmt, va_list ap)
la->empty = 0;
msg = (struct logmsg *)la->tail;
msg->prio = prio;
- strcpy((void *)&msg->str, buff);
+ memcpy((void *)&msg->str, buff, strlen(buff) + 1);
lastmsg->next = la->tail;
msg->next = la->head;
--
1.7.6.5
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment