diff options
author | Alexey Shvetsov <alexxy@gentoo.org> | 2012-05-25 21:48:33 +0000 |
---|---|---|
committer | Alexey Shvetsov <alexxy@gentoo.org> | 2012-05-25 21:48:33 +0000 |
commit | 75d159e3f78d96a795228620bf6c59bbc081424c (patch) | |
tree | fb118e3f0629a0c14d971813efa295d3c4e62075 /sys-fs/multipath-tools | |
parent | Enable threshold and v5upgrade plugins (diff) | |
download | gentoo-2-75d159e3f78d96a795228620bf6c59bbc081424c.tar.gz gentoo-2-75d159e3f78d96a795228620bf6c59bbc081424c.tar.bz2 gentoo-2-75d159e3f78d96a795228620bf6c59bbc081424c.zip |
[sys-fs/multipath-tools] Fix bugs #413063 and #399569
(Portage version: 2.2.0_alpha108/cvs/Linux x86_64)
Diffstat (limited to 'sys-fs/multipath-tools')
3 files changed, 152 insertions, 1 deletions
diff --git a/sys-fs/multipath-tools/ChangeLog b/sys-fs/multipath-tools/ChangeLog index ff4ec8a69976..6dec3746d5de 100644 --- a/sys-fs/multipath-tools/ChangeLog +++ b/sys-fs/multipath-tools/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-fs/multipath-tools # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/multipath-tools/ChangeLog,v 1.43 2012/05/22 15:01:19 xarthisius Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/multipath-tools/ChangeLog,v 1.44 2012/05/25 21:48:33 alexxy Exp $ + +*multipath-tools-0.4.9-r4 (25 May 2012) + + 25 May 2012; Alexey Shvetsov <alexxy@gentoo.org> + +files/multipath-tools-0.4.9-log_enquery_overflow.patch, + +multipath-tools-0.4.9-r4.ebuild: + [sys-fs/multipath-tools] Fix bugs #413063 and #399569 22 May 2012; Kacper Kowalik <xarthisius@gentoo.org> files/multipath-tools-0.4.9-build.patch: diff --git a/sys-fs/multipath-tools/files/multipath-tools-0.4.9-log_enquery_overflow.patch b/sys-fs/multipath-tools/files/multipath-tools-0.4.9-log_enquery_overflow.patch new file mode 100644 index 000000000000..67367c9f42e0 --- /dev/null +++ b/sys-fs/multipath-tools/files/multipath-tools-0.4.9-log_enquery_overflow.patch @@ -0,0 +1,69 @@ +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 + diff --git a/sys-fs/multipath-tools/multipath-tools-0.4.9-r4.ebuild b/sys-fs/multipath-tools/multipath-tools-0.4.9-r4.ebuild new file mode 100644 index 000000000000..fa64e8943b2d --- /dev/null +++ b/sys-fs/multipath-tools/multipath-tools-0.4.9-r4.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/multipath-tools/multipath-tools-0.4.9-r4.ebuild,v 1.1 2012/05/25 21:48:33 alexxy Exp $ + +EAPI="4" + +inherit eutils toolchain-funcs + +DESCRIPTION="Device mapper target autoconfig" +HOMEPAGE="http://christophe.varoqui.free.fr/" +SRC_URI="http://christophe.varoqui.free.fr/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86" +IUSE="" + +RDEPEND="|| ( + >=sys-fs/lvm2-2.02.45 + >=sys-fs/device-mapper-1.00.19-r1 + ) + >=sys-fs/udev-124 + dev-libs/libaio + sys-libs/readline + !<sys-apps/baselayout-2" +DEPEND="${RDEPEND}" + +S="${WORKDIR}" + +PATCHES=( + "${FILESDIR}/${PN}-0.4.9-build.patch" + "${FILESDIR}/${PN}-0.4.9-buffer-overflows.patch" + "${FILESDIR}/${PN}-0.4.8-kparted-ext-partitions.patch" + "${FILESDIR}/${PN}-0.4.9-log_enquery_overflow.patch" +) + +src_compile() { + # LIBDM_API_FLUSH involves grepping files in /usr/include, + # so force the test to go the way we want #411337. + emake LIBDM_API_FLUSH=1 CC="$(tc-getCC)" || die +} + +src_install() { + dodir /sbin /usr/share/man/man8 + emake DESTDIR="${D}" install || die + + insinto /etc + newins "${S}"/multipath.conf.annotated multipath.conf + # drop this one it doesnt work with recent udev bug #413063 + rm "${D}/etc/udev/rules.d/65-multipath.rules" + fperms 644 /etc/udev/rules.d/66-kpartx.rules + newinitd "${FILESDIR}"/rc-multipathd multipathd || die + newinitd "${FILESDIR}"/multipath.rc multipath || die + + dodoc multipath.conf.* AUTHOR ChangeLog FAQ README TODO + docinto kpartx + dodoc kpartx/ChangeLog kpartx/README +} + +pkg_preinst() { + # The dev.d script was previously wrong and is now removed (the udev rules + # file does the job instead), but it won't be removed from live systems due + # to cfgprotect. + # This should help out a little... + if [[ -e ${ROOT}/etc/dev.d/block/multipath.dev ]] ; then + mkdir -p "${D}"/etc/dev.d/block + echo "# Please delete this file. It is obsoleted by /etc/udev/rules.d/65-multipath.rules" \ + > "${D}"/etc/dev.d/block/multipath.dev + fi +} + +pkg_postinst() { + elog "If you need multipath on your system, you must" + elog "add 'multipath' into your boot runlevel!" +} |