From 3b016f20fde4c22658f44114d0e83e3c96925e46 Mon Sep 17 00:00:00 2001 From: Joshua Kinard Date: Wed, 18 Feb 2004 21:56:26 +0000 Subject: Added a patch to fix the recent do_munmap kernel vuln. --- sys-kernel/mips-prepatch-sources/ChangeLog | 9 ++- sys-kernel/mips-prepatch-sources/Manifest | 7 +- .../files/digest-mips-prepatch-sources-2.4.25_pre6 | 4 -- .../digest-mips-prepatch-sources-2.4.25_pre6-r1 | 4 ++ .../files/do_munmap-fix.patch | 27 ++++++++ .../mips-prepatch-sources-2.4.25_pre6-r1.ebuild | 74 ++++++++++++++++++++++ .../mips-prepatch-sources-2.4.25_pre6.ebuild | 71 --------------------- 7 files changed, 117 insertions(+), 79 deletions(-) delete mode 100644 sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6 create mode 100644 sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6-r1 create mode 100644 sys-kernel/mips-prepatch-sources/files/do_munmap-fix.patch create mode 100644 sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6-r1.ebuild delete mode 100644 sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6.ebuild (limited to 'sys-kernel/mips-prepatch-sources') diff --git a/sys-kernel/mips-prepatch-sources/ChangeLog b/sys-kernel/mips-prepatch-sources/ChangeLog index c7f7fe98e0dd..68b4543a4cca 100644 --- a/sys-kernel/mips-prepatch-sources/ChangeLog +++ b/sys-kernel/mips-prepatch-sources/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-kernel/mips-prepatch-sources # Copyright 2000-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/mips-prepatch-sources/ChangeLog,v 1.8 2004/02/10 06:57:29 kumba Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/mips-prepatch-sources/ChangeLog,v 1.9 2004/02/18 21:56:26 kumba Exp $ + +*mips-prepatch-sources-2.4.25_pre6-r1 (18 Feb 2004) + + 18 Feb 2004; Joshua Kinard + mips-prepatch-sources-2.4.25_pre6-r1.ebuild, + mips-prepatch-sources-2.4.25_pre6.ebuild, files/do_munmap-fix.patch: + Added a patch to fix the recent do_munmap kernel vuln. *mips-prepatch-sources-2.4.25_pre6 (10 Feb 2004) diff --git a/sys-kernel/mips-prepatch-sources/Manifest b/sys-kernel/mips-prepatch-sources/Manifest index c803dc13ec62..c2b90b81c50f 100644 --- a/sys-kernel/mips-prepatch-sources/Manifest +++ b/sys-kernel/mips-prepatch-sources/Manifest @@ -1,6 +1,7 @@ -MD5 a5ce475ad1df19a89d35f187407a4acb ChangeLog 2285 +MD5 0acdef48f938861cae8239eccfd3906c ChangeLog 2562 MD5 0bfb6b59036d1fe3e8075bc8879e772b metadata.xml 412 -MD5 b6e6b794c36f3011a2aac836e2138209 mips-prepatch-sources-2.4.25_pre6.ebuild 2148 +MD5 be3fcdaf5fbf685bb25204b3f415c38e mips-prepatch-sources-2.4.25_pre6-r1.ebuild 2227 MD5 d41d8cd98f00b204e9800998ecf8427e files/.keep 0 -MD5 1646cb074c99365f653d5db9416625dc files/digest-mips-prepatch-sources-2.4.25_pre6 290 +MD5 174438d215b70cad5ffb00ca8123c062 files/do_munmap-fix.patch 837 +MD5 1646cb074c99365f653d5db9416625dc files/digest-mips-prepatch-sources-2.4.25_pre6-r1 290 MD5 1f2d806ba24602d1a46129700e8fcc5d files/mipscvs-2.4.25-pre6-20040209-makefile.patch 1513 diff --git a/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6 b/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6 deleted file mode 100644 index b04d6ff75229..000000000000 --- a/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6 +++ /dev/null @@ -1,4 +0,0 @@ -MD5 1e055c42921b2396a559d84df4c3d9aa linux-2.4.24.tar.bz2 29837818 -MD5 446ba59d61433604f65b0be98f980849 patch-2.4.25-pre6.bz2 1639920 -MD5 f1c54736fe2ef4e807cb83aca4523520 mipscvs-2.4.25-pre6-20040209.diff.bz2 121803 -MD5 3164a83e10562b34fa250fd9b892b5b2 cobalt-patches-24xx-1.1.tar.bz2 3831 diff --git a/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6-r1 b/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6-r1 new file mode 100644 index 000000000000..b04d6ff75229 --- /dev/null +++ b/sys-kernel/mips-prepatch-sources/files/digest-mips-prepatch-sources-2.4.25_pre6-r1 @@ -0,0 +1,4 @@ +MD5 1e055c42921b2396a559d84df4c3d9aa linux-2.4.24.tar.bz2 29837818 +MD5 446ba59d61433604f65b0be98f980849 patch-2.4.25-pre6.bz2 1639920 +MD5 f1c54736fe2ef4e807cb83aca4523520 mipscvs-2.4.25-pre6-20040209.diff.bz2 121803 +MD5 3164a83e10562b34fa250fd9b892b5b2 cobalt-patches-24xx-1.1.tar.bz2 3831 diff --git a/sys-kernel/mips-prepatch-sources/files/do_munmap-fix.patch b/sys-kernel/mips-prepatch-sources/files/do_munmap-fix.patch new file mode 100644 index 000000000000..e120b35b7adb --- /dev/null +++ b/sys-kernel/mips-prepatch-sources/files/do_munmap-fix.patch @@ -0,0 +1,27 @@ +diff -ur linux-2.4.25-rc3/mm/mremap.c linux-2.4.25-rc4/mm/mremap.c +--- linux-2.4.25-rc3/mm/mremap.c 2004-02-18 13:56:01.000000000 +0000 ++++ linux-2.4.25-rc4/mm/mremap.c 2004-02-18 13:49:08.000000000 +0000 +@@ -258,16 +258,20 @@ + 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 && new_len) ++ goto out; + } + + /* + * Always allow a shrinking remap: that just unmaps + * the unnecessary pages.. + */ +- 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; + } diff --git a/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6-r1.ebuild b/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6-r1.ebuild new file mode 100644 index 000000000000..8af2ecab9ee4 --- /dev/null +++ b/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6-r1.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6-r1.ebuild,v 1.1 2004/02/18 21:56:26 kumba Exp $ + + +# Version Data +OKV=${PV/_/-} +CVSDATE="20040209" +EXTRAVERSION="-mipscvs-${CVSDATE}" +KV="${OKV}${EXTRAVERSION}" +COBALTPATCHVER="1.1" +STABLEVERSION="2.4.24" + +# Miscellaneous +S=${WORKDIR}/linux-${OKV}-${CVSDATE} + +# Eclass Stuff +ETYPE="sources" +inherit kernel eutils + + +# INCLUDED: +# 1) linux stable sources from kernel.org +# 2) patch to latest linux prepatch sources +# 3) linux-mips.org CVS snapshot diff from 09 Feb 2004 +# 4) patch to fix Makefile(s) to pass appropriate CFLAGS +# 5) Patches for Cobalt support + + +DESCRIPTION="Linux-Mips CVS pre-patch sources for MIPS-based machines" +SRC_URI="mirror://kernel/linux/kernel/v2.4/linux-${STABLEVERSION}.tar.bz2 + mirror://kernel/linux/kernel/v2.4/testing/patch-${OKV}.bz2 + mirror://gentoo/mipscvs-${OKV}-${CVSDATE}.diff.bz2 + mirror://gentoo/cobalt-patches-24xx-${COBALTPATCHVER}.tar.bz2" +HOMEPAGE="http://www.kernel.org http://www.linux-mips.org/" +SLOT="${OKV}" +PROVIDE="virtual/linux-sources" +KEYWORDS="-* ~mips" + + +src_unpack() { + unpack ${A} + mv ${WORKDIR}/linux-${STABLEVERSION} ${S} + cd ${S} + + # Update the vanilla sources with prepatch diff + einfo ">>> Patching linux-${STABLEVERSION} to linux-${OKV} ..." + epatch ${WORKDIR}/patch-${OKV} + echo -e "" + + # Update the vanilla prepatch sources with linux-mips CVS changes + einfo ">>> Patching linux-${OKV} to linux-${OKV}${EXTRAVERSION} ..." + epatch ${WORKDIR}/mipscvs-${OKV}-${CVSDATE}.diff + echo -e "" + + # Patch arch/mips/Makefile & arch/mips64/Makefile + einfo ">>> Patching Makefile(s) ..." + epatch ${FILESDIR}/mipscvs-${OKV}-${CVSDATE}-makefile.patch + echo -e "" + + # do_munmap fix (Possibly Exploitable) + epatch ${FILESDIR}/do_munmap-fix.patch + + # Cobalt stuff + if [ "${PROFILE_ARCH}" = "cobalt" ]; then + einfo ">>> Patching kernel for Cobalt support ..." + for x in ${WORKDIR}/cobalt-patches-24xx-${COBALTPATCHVER}/*.patch; do + epatch ${x} + done + cp ${WORKDIR}/cobalt-patches-24xx-${COBALTPATCHVER}/cobalt-patches.txt ${S} + fi + + kernel_universal_unpack +} diff --git a/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6.ebuild b/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6.ebuild deleted file mode 100644 index d323d3497f4e..000000000000 --- a/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6.ebuild +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 1999-2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/mips-prepatch-sources/mips-prepatch-sources-2.4.25_pre6.ebuild,v 1.1 2004/02/10 06:57:29 kumba Exp $ - - -# Version Data -OKV=${PV/_/-} -CVSDATE="20040209" -EXTRAVERSION="-mipscvs-${CVSDATE}" -KV="${OKV}${EXTRAVERSION}" -COBALTPATCHVER="1.1" -STABLEVERSION="2.4.24" - -# Miscellaneous -S=${WORKDIR}/linux-${OKV}-${CVSDATE} - -# Eclass Stuff -ETYPE="sources" -inherit kernel eutils - - -# INCLUDED: -# 1) linux stable sources from kernel.org -# 2) patch to latest linux prepatch sources -# 3) linux-mips.org CVS snapshot diff from 09 Feb 2004 -# 4) patch to fix Makefile(s) to pass appropriate CFLAGS -# 5) Patches for Cobalt support - - -DESCRIPTION="Linux-Mips CVS pre-patch sources for MIPS-based machines" -SRC_URI="mirror://kernel/linux/kernel/v2.4/linux-${STABLEVERSION}.tar.bz2 - mirror://kernel/linux/kernel/v2.4/testing/patch-${OKV}.bz2 - mirror://gentoo/mipscvs-${OKV}-${CVSDATE}.diff.bz2 - mirror://gentoo/cobalt-patches-24xx-${COBALTPATCHVER}.tar.bz2" -HOMEPAGE="http://www.kernel.org http://www.linux-mips.org/" -SLOT="${OKV}" -PROVIDE="virtual/linux-sources" -KEYWORDS="-* ~mips" - - -src_unpack() { - unpack ${A} - mv ${WORKDIR}/linux-${STABLEVERSION} ${S} - cd ${S} - - # Update the vanilla sources with prepatch diff - einfo ">>> Patching linux-${STABLEVERSION} to linux-${OKV} ..." - epatch ${WORKDIR}/patch-${OKV} - echo -e "" - - # Update the vanilla prepatch sources with linux-mips CVS changes - einfo ">>> Patching linux-${OKV} to linux-${OKV}${EXTRAVERSION} ..." - epatch ${WORKDIR}/mipscvs-${OKV}-${CVSDATE}.diff - echo -e "" - - # Patch arch/mips/Makefile & arch/mips64/Makefile - einfo ">>> Patching Makefile(s) ..." - epatch ${FILESDIR}/mipscvs-${OKV}-${CVSDATE}-makefile.patch - echo -e "" - - # Cobalt stuff -# if [ "${PROFILE_ARCH}" = "cobalt" ]; then - einfo ">>> Patching kernel for Cobalt support ..." - for x in ${WORKDIR}/cobalt-patches-24xx-${COBALTPATCHVER}/*.patch; do - epatch ${x} - done - cp ${WORKDIR}/cobalt-patches-24xx-${COBALTPATCHVER}/cobalt-patches.txt ${S} -# fi - - kernel_universal_unpack -} -- cgit v1.2.3-65-gdbad