diff options
author | Tim Yamin <plasmaroo@gentoo.org> | 2004-02-18 19:13:49 +0000 |
---|---|---|
committer | Tim Yamin <plasmaroo@gentoo.org> | 2004-02-18 19:13:49 +0000 |
commit | e64de6ff19431fddd479eb73fafac69ef502a027 (patch) | |
tree | 4f4665cab52e50636aebaddb68c41a8208389256 | |
parent | adding metadata.xml (diff) | |
download | gentoo-2-e64de6ff19431fddd479eb73fafac69ef502a027.tar.gz gentoo-2-e64de6ff19431fddd479eb73fafac69ef502a027.tar.bz2 gentoo-2-e64de6ff19431fddd479eb73fafac69ef502a027.zip |
Added the patch for the mremap/munmap vulnerability. Bug #42024.
4 files changed, 109 insertions, 3 deletions
diff --git a/sys-kernel/hppa-dev-sources/ChangeLog b/sys-kernel/hppa-dev-sources/ChangeLog index 75f0fb4faf19..e67d947968de 100644 --- a/sys-kernel/hppa-dev-sources/ChangeLog +++ b/sys-kernel/hppa-dev-sources/ChangeLog @@ -1,8 +1,14 @@ # ChangeLog for sys-kernel/hppa-dev-sources -# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/hppa-dev-sources/ChangeLog,v 1.6 2004/02/05 22:10:00 gmsoft Exp $ +# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/hppa-dev-sources/ChangeLog,v 1.7 2004/02/18 19:13:49 plasmaroo Exp $ -*hppa-dev-sources-2.6.2_p3 (005 Feb 2004) +*hppa-dev-sources-2.6.2_p3-r1 (18 Feb 2004) + + 18 Feb 2004; <plasmaroo@gentoo.org> hppa-dev-sources-2.6.2_p3-r1.ebuild, + files/hppa-dev-sources-2.6.2_p3.munmap.patch: + Added the patch for the mremap/munmap vulnerability. Bug #42024. + +*hppa-dev-sources-2.6.2_p3 (05 Feb 2004) 05 Feb 02004; Guy Martin <gmsoft@gentoo.org> hppa-dev-sources-2.6.2_p3.ebuild : Version bump. diff --git a/sys-kernel/hppa-dev-sources/files/digest-hppa-dev-sources-2.6.2_p3-r1 b/sys-kernel/hppa-dev-sources/files/digest-hppa-dev-sources-2.6.2_p3-r1 new file mode 100644 index 000000000000..7bc8c238b80d --- /dev/null +++ b/sys-kernel/hppa-dev-sources/files/digest-hppa-dev-sources-2.6.2_p3-r1 @@ -0,0 +1,4 @@ +MD5 2a745088acba366f22f8bd3e284a84d4 linux-2.6.2.tar.bz2 33899733 +MD5 bac25a0908ec16d834820b5ec289b2e7 patch-2.6.2-pa0.gz 149704 +MD5 093d9569f00e47f6a300cebf3a884e42 patch-2.6.2-pa0-pa1.gz 1635 +MD5 6e3ca3b359a39712c965ba1494f1620d patch-2.6.2-pa1-pa3.gz 1273 diff --git a/sys-kernel/hppa-dev-sources/files/hppa-dev-sources-2.6.2_p3.munmap.patch b/sys-kernel/hppa-dev-sources/files/hppa-dev-sources-2.6.2_p3.munmap.patch new file mode 100644 index 000000000000..47a199c870db --- /dev/null +++ b/sys-kernel/hppa-dev-sources/files/hppa-dev-sources-2.6.2_p3.munmap.patch @@ -0,0 +1,53 @@ +diff -Naur 2.6.2/mm/mremap.c 2.6.3/mm/mremap.c +--- 2.6.2/mm/mremap.c 2004-02-18 03:29:48.000000000 +0100 ++++ 2.6.3/mm/mremap.c 2004-02-18 10:21:20.000000000 +0100 +@@ -135,15 +135,17 @@ + dst = alloc_one_pte_map(mm, new_addr); + if (src == NULL) + src = get_one_pte_map_nested(mm, old_addr); +- error = copy_one_pte(vma, old_addr, src, dst, &pte_chain); +- pte_unmap_nested(src); +- pte_unmap(dst); +- } else + /* +- * Why do we need this flush ? If there is no pte for +- * old_addr, then there must not be a pte for it as well. ++ * Since alloc_one_pte_map can drop and re-acquire ++ * page_table_lock, we should re-check the src entry... + */ +- flush_tlb_page(vma, old_addr); ++ if (src) { ++ error = copy_one_pte(vma, old_addr, src, ++ dst, &pte_chain); ++ pte_unmap_nested(src); ++ } ++ pte_unmap(dst); ++ } + spin_unlock(&mm->page_table_lock); + pte_chain_free(pte_chain); + out: +@@ -346,7 +348,9 @@ + if ((addr <= new_addr) && (addr+old_len) > new_addr) + goto out; + +- do_munmap(current->mm, new_addr, new_len); ++ ret = do_munmap(current->mm, new_addr, new_len); ++ if (ret) ++ goto out; + } + + /* +@@ -354,9 +358,11 @@ + * the unnecessary pages.. + * do_munmap does all the needed commit accounting + */ +- ret = addr; + if (old_len >= new_len) { +- do_munmap(current->mm, addr+new_len, old_len - new_len); ++ ret = do_munmap(current->mm, addr+new_len, old_len - new_len); ++ if (ret && old_len != new_len) ++ goto out; ++ ret = addr; + if (!(flags & MREMAP_FIXED) || (new_addr == addr)) + goto out; + old_len = new_len; diff --git a/sys-kernel/hppa-dev-sources/hppa-dev-sources-2.6.2_p3-r1.ebuild b/sys-kernel/hppa-dev-sources/hppa-dev-sources-2.6.2_p3-r1.ebuild new file mode 100644 index 000000000000..bdf5a290a359 --- /dev/null +++ b/sys-kernel/hppa-dev-sources/hppa-dev-sources-2.6.2_p3-r1.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/hppa-dev-sources/hppa-dev-sources-2.6.2_p3-r1.ebuild,v 1.1 2004/02/18 19:13:49 plasmaroo Exp $ +#OKV=original kernel version, KV=patched kernel version. They can be the same. + +ETYPE="sources" +inherit kernel +OKV="${PV/_p*/}" +PATCH_LEVEL="${PV/${OKV}_p/}" +KV=${OKV}-pa${PATCH_LEVEL} +EXTRAVERSION="-pa${PATCH_LEVEL}" +S=${WORKDIR}/linux-${KV} + +PATCH_SET="0 1 ${PATCH_LEVEL}" +PATCH_COUNT="$(( `echo ${PATCH_SET} | wc -w` - 1 ))" + +DESCRIPTION="Full sources for the Linux kernel with patch for hppa" +SRC_URI="mirror://kernel/linux/kernel/v2.6/linux-${OKV}.tar.bz2 http://ftp.parisc-linux.org/cvs/linux-2.6/patch-${OKV}-pa`echo ${PATCH_SET} | awk '{ print $1 }'`.gz +`for i in \`seq 1 ${PATCH_COUNT}\`; do echo http://ftp.parisc-linux.org/cvs/linux-2.6/patch-${OKV}-pa\`echo ${PATCH_SET} | awk \"{ print \\\\\$$i }\"\`-pa\`echo ${PATCH_SET} | awk \"{ print \\\\\$$((i + 1)) }\"\`.gz; done`" +HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ http://parisc-linux.org" +KEYWORDS="hppa -*" +SLOT="${KV}" + + +src_unpack() { + unpack linux-${OKV}.tar.bz2 + mv ${WORKDIR}/linux-${OKV} ${WORKDIR}/linux-${KV} + cd ${S} + + einfo Applying ${OKV}-pa`echo ${PATCH_SET} | awk '{ print $1 }'` + zcat ${DISTDIR}/patch-${OKV}-pa`echo ${PATCH_SET} | awk '{ print $1 }'`.gz | patch -sp 1 + + for i in `seq 1 ${PATCH_COUNT}` + do + a=`echo ${PATCH_SET} | awk "{ print \\\$$i }"` + b=`echo ${PATCH_SET} | awk "{ print \\\$$((i + 1)) }"` + einfo Applying patch from ${OKV}-pa${a} to ${OKV}-pa${b} + zcat ${DISTDIR}/patch-${OKV}-pa${a}-pa${b}.gz | patch -sp 1 + done + + epatch ${FILESDIR}/${P}.munmap.patch || die "Failed to apply munmap patch!" + ARCH=parisc kernel_universal_unpack +} |