summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-07-03 11:08:00 +0000
committerRoy Marples <uberlord@gentoo.org>2007-07-03 11:08:00 +0000
commit62ff68700bbe4a492776c5eee700e13fc732c85b (patch)
tree9dd03e18541e25bddc620deacadc03c487fec4e5 /sys-freebsd/freebsd-sources
parentDropped old versions. (diff)
downloadgentoo-2-62ff68700bbe4a492776c5eee700e13fc732c85b.tar.gz
gentoo-2-62ff68700bbe4a492776c5eee700e13fc732c85b.tar.bz2
gentoo-2-62ff68700bbe4a492776c5eee700e13fc732c85b.zip
Push out errata patches for GIF/IPv6 and unix domain sockets.
(Portage version: 2.1.3_rc6)
Diffstat (limited to 'sys-freebsd/freebsd-sources')
-rw-r--r--sys-freebsd/freebsd-sources/ChangeLog9
-rw-r--r--sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.2-r23
-rw-r--r--sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-EN-07:02.net.patch16
-rw-r--r--sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-unp_gc.patch221
-rw-r--r--sys-freebsd/freebsd-sources/freebsd-sources-6.2-r2.ebuild91
5 files changed, 339 insertions, 1 deletions
diff --git a/sys-freebsd/freebsd-sources/ChangeLog b/sys-freebsd/freebsd-sources/ChangeLog
index 2a7ea64a6cba..d14201eb905a 100644
--- a/sys-freebsd/freebsd-sources/ChangeLog
+++ b/sys-freebsd/freebsd-sources/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-freebsd/freebsd-sources
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sources/ChangeLog,v 1.37 2007/05/10 10:24:54 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sources/ChangeLog,v 1.38 2007/07/03 11:08:00 uberlord Exp $
+
+*freebsd-sources-6.2-r2 (03 Jul 2007)
+
+ 03 Jul 2007; Roy Marples <uberlord@gentoo.org>
+ +files/freebsd-sources-6.2-EN-07:02.net.patch,
+ +files/freebsd-sources-6.2-unp_gc.patch, +freebsd-sources-6.2-r2.ebuild:
+ Push out errata patches for GIF/IPv6 and unix domain sockets.
*freebsd-sources-6.2-r1 (10 May 2007)
diff --git a/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.2-r2 b/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.2-r2
new file mode 100644
index 000000000000..f15ec910fc83
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.2-r2
@@ -0,0 +1,3 @@
+MD5 79c16213744e76d3bf13a9ac21ede56d freebsd-sys-6.2.tar.bz2 18344936
+RMD160 784230e22ccaf09933ef3f053ff29cc3e579786a freebsd-sys-6.2.tar.bz2 18344936
+SHA256 a754371d88601aaab7152bb3d127bd3777db912e13a26a866e13ba34934c5e5b freebsd-sys-6.2.tar.bz2 18344936
diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-EN-07:02.net.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-EN-07:02.net.patch
new file mode 100644
index 000000000000..23cb15651bbc
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-EN-07:02.net.patch
@@ -0,0 +1,16 @@
+Index: sys/netinet6/nd6.c
+===================================================================
+RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v
+retrieving revision 1.48.2.15
+diff -u -r1.48.2.15 nd6.c
+--- sys/netinet6/nd6.c 7 Oct 2006 18:31:27 -0000 1.48.2.15
++++ sys/netinet6/nd6.c 15 Feb 2007 02:34:00 -0000
+@@ -1315,7 +1315,7 @@
+ callout_init(&ln->ln_timer_ch, 0);
+
+ /* this is required for "ndp" command. - shin */
+- if (req == RTM_ADD && (rt->rt_flags & RTF_STATIC)) {
++ if (req == RTM_ADD) {
+ /*
+ * gate should have some valid AF_LINK entry,
+ * and ln->ln_expire should have some lifetime
diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-unp_gc.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-unp_gc.patch
new file mode 100644
index 000000000000..e3dd8c0b2af3
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.2-unp_gc.patch
@@ -0,0 +1,221 @@
+--- src/sys/kern/kern_descrip.c 2006/09/29 12:29:26
++++ src/sys/kern/kern_descrip.c 2006/12/29 16:06:02
+@@ -2150,6 +2150,17 @@
+ FILE_UNLOCK(fp);
+ return (0);
+ }
++
++ /*
++ * We might have just dropped the last reference to a file
++ * object that is for a UNIX domain socket whose message
++ * buffers are being examined in unp_gc(). If that is the
++ * case, FWAIT will be set in f_gcflag and we need to wait for
++ * unp_gc() to finish its scan.
++ */
++ while (fp->f_gcflag & FWAIT)
++ msleep(&fp->f_gcflag, fp->f_mtxp, 0, "fpdrop", 0);
++
+ /* We have the last ref so we can proceed without the file lock. */
+ FILE_UNLOCK(fp);
+ if (fp->f_count < 0)
+--- src/sys/kern/uipc_usrreq.c 2006/07/13 07:28:19
++++ src/sys/kern/uipc_usrreq.c 2006/12/29 16:16:12
+@@ -68,6 +69,17 @@
+
+ #include <vm/uma.h>
+
++/*
++ * We allocate wrapper objects that add the reference count to an existing
++ * unpcb in 6.x to preserve the ABI layout of unpcb.
++ */
++struct unpcb_wrapper {
++ struct unpcb unpw_unpcb;
++ u_int unpw_refcount;
++};
++
++#define UNP_REFCOUNT(unp) (((struct unpcb_wrapper *)(unp))->unpw_refcount)
++
+ static uma_zone_t unp_zone;
+ static unp_gen_t unp_gencnt;
+ static u_int unp_count;
+@@ -769,6 +781,7 @@
+ unp->unp_socket = so;
+ so->so_pcb = unp;
+
++ UNP_REFCOUNT(unp) = 1;
+ UNP_LOCK();
+ unp->unp_gencnt = ++unp_gencnt;
+ unp_count++;
+@@ -782,8 +795,10 @@
+ static void
+ unp_detach(struct unpcb *unp)
+ {
++ struct sockaddr_un *saved_unp_addr;
+ struct vnode *vp;
+ int local_unp_rights;
++ int freeunp;
+
+ UNP_LOCK_ASSERT();
+
+@@ -807,10 +822,15 @@
+ soisdisconnected(unp->unp_socket);
+ unp->unp_socket->so_pcb = NULL;
+ local_unp_rights = unp_rights;
++ saved_unp_addr = unp->unp_addr;
++ unp->unp_addr = NULL;
++ UNP_REFCOUNT(unp)--;
++ freeunp = (UNP_REFCOUNT(unp) == 0);
+ UNP_UNLOCK();
+- if (unp->unp_addr != NULL)
+- FREE(unp->unp_addr, M_SONAME);
+- uma_zfree(unp_zone, unp);
++ if (saved_unp_addr != NULL)
++ FREE(saved_unp_addr, M_SONAME);
++ if (freeunp)
++ uma_zfree(unp_zone, unp);
+ if (vp) {
+ int vfslocked;
+
+@@ -1126,6 +1146,7 @@
+ unp_pcblist(SYSCTL_HANDLER_ARGS)
+ {
+ int error, i, n;
++ int freeunp;
+ struct unpcb *unp, **unp_list;
+ unp_gen_t gencnt;
+ struct xunpgen *xug;
+@@ -1177,6 +1198,7 @@
+ unp->unp_socket->so_cred))
+ continue;
+ unp_list[i++] = unp;
++ UNP_REFCOUNT(unp)++;
+ }
+ }
+ UNP_UNLOCK();
+@@ -1186,7 +1208,9 @@
+ xu = malloc(sizeof(*xu), M_TEMP, M_WAITOK | M_ZERO);
+ for (i = 0; i < n; i++) {
+ unp = unp_list[i];
+- if (unp->unp_gencnt <= gencnt) {
++ UNP_LOCK();
++ UNP_REFCOUNT(unp)--;
++ if (UNP_REFCOUNT(unp) != 0 && unp->unp_gencnt <= gencnt) {
+ xu->xu_len = sizeof *xu;
+ xu->xu_unpp = unp;
+ /*
+@@ -1203,7 +1227,13 @@
+ unp->unp_conn->unp_addr->sun_len);
+ bcopy(unp, &xu->xu_unp, sizeof *unp);
+ sotoxsocket(unp->unp_socket, &xu->xu_socket);
++ UNP_UNLOCK();
+ error = SYSCTL_OUT(req, xu, sizeof *xu);
++ } else {
++ freeunp = (UNP_REFCOUNT(unp) == 0);
++ UNP_UNLOCK();
++ if (freeunp)
++ uma_zfree(unp_zone, unp);
+ }
+ }
+ free(xu, M_TEMP);
+@@ -1401,8 +1431,8 @@
+ void
+ unp_init(void)
+ {
+- unp_zone = uma_zcreate("unpcb", sizeof(struct unpcb), NULL, NULL,
+- NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
++ unp_zone = uma_zcreate("unpcb", sizeof(struct unpcb_wrapper), NULL,
++ NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (unp_zone == NULL)
+ panic("unp_init");
+ uma_zone_set_max(unp_zone, maxsockets);
+@@ -1636,7 +1666,7 @@
+ unp_defer = 0;
+ /*
+ * before going through all this, set all FDs to
+- * be NOT defered and NOT externally accessible
++ * be NOT deferred and NOT externally accessible
+ */
+ sx_slock(&filelist_lock);
+ LIST_FOREACH(fp, &filehead, f_list)
+@@ -1659,16 +1689,16 @@
+ continue;
+ }
+ /*
+- * If we already marked it as 'defer' in a
+- * previous pass, then try process it this time
+- * and un-mark it
++ * If we already marked it as 'defer' in a
++ * previous pass, then try to process it this
++ * time and un-mark it
+ */
+ if (fp->f_gcflag & FDEFER) {
+ fp->f_gcflag &= ~FDEFER;
+ unp_defer--;
+ } else {
+ /*
+- * if it's not defered, then check if it's
++ * if it's not deferred, then check if it's
+ * already marked.. if so skip it
+ */
+ if (fp->f_gcflag & FMARK) {
+@@ -1691,7 +1721,7 @@
+ fp->f_gcflag |= FMARK;
+ }
+ /*
+- * either it was defered, or it is externally
++ * either it was deferred, or it is externally
+ * accessible and not already marked so.
+ * Now check if it is possibly one of OUR sockets.
+ */
+@@ -1700,13 +1730,23 @@
+ FILE_UNLOCK(fp);
+ continue;
+ }
+- FILE_UNLOCK(fp);
+ if (so->so_proto->pr_domain != &localdomain ||
+- (so->so_proto->pr_flags&PR_RIGHTS) == 0)
++ (so->so_proto->pr_flags & PR_RIGHTS) == 0) {
++ FILE_UNLOCK(fp);
+ continue;
++ }
++
++ /*
++ * Tell any other threads that do a subsequent
++ * fdrop() that we are scanning the message
++ * buffers.
++ */
++ fp->f_gcflag |= FWAIT;
++ FILE_UNLOCK(fp);
++
+ /*
+ * So, Ok, it's one of our sockets and it IS externally
+- * accessible (or was defered). Now we look
++ * accessible (or was deferred). Now we look
+ * to see if we hold any file descriptors in its
+ * message buffers. Follow those links and mark them
+ * as accessible too.
+@@ -1714,6 +1754,14 @@
+ SOCKBUF_LOCK(&so->so_rcv);
+ unp_scan(so->so_rcv.sb_mb, unp_mark);
+ SOCKBUF_UNLOCK(&so->so_rcv);
++
++ /*
++ * Wake up any threads waiting in fdrop().
++ */
++ FILE_LOCK(fp);
++ fp->f_gcflag &= ~FWAIT;
++ wakeup(&fp->f_gcflag);
++ FILE_UNLOCK(fp);
+ }
+ } while (unp_defer);
+ sx_sunlock(&filelist_lock);
+--- src/sys/sys/file.h 2006/05/29 20:28:17
++++ src/sys/sys/file.h 2006/12/29 16:16:12
+@@ -127,6 +127,7 @@
+ short f_gcflag; /* used by thread doing fd garbage collection */
+ #define FMARK 0x1 /* mark during gc() */
+ #define FDEFER 0x2 /* defer for next gc pass */
++#define FWAIT 0x4 /* gc is scanning message buffers */
+ int f_msgcount; /* (f) references from message queue */
+
+ /* DTYPE_VNODE specific fields */
diff --git a/sys-freebsd/freebsd-sources/freebsd-sources-6.2-r2.ebuild b/sys-freebsd/freebsd-sources/freebsd-sources-6.2-r2.ebuild
new file mode 100644
index 000000000000..126b067f2107
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/freebsd-sources-6.2-r2.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sources/freebsd-sources-6.2-r2.ebuild,v 1.1 2007/07/03 11:08:00 uberlord Exp $
+
+inherit bsdmk freebsd flag-o-matic
+
+DESCRIPTION="FreeBSD kernel sources"
+SLOT="${PVR}"
+KEYWORDS="~sparc-fbsd ~x86-fbsd"
+
+IUSE="symlink"
+
+SRC_URI="mirror://gentoo/${SYS}.tar.bz2"
+
+RDEPEND=">=sys-freebsd/freebsd-mk-defs-6.0-r1"
+DEPEND=""
+
+RESTRICT="strip binchecks"
+
+S="${WORKDIR}/sys"
+
+MY_PVR="${PVR}"
+
+[[ ${MY_PVR} == "${RV}" ]] && MY_PVR="${MY_PVR}-r0"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # This replaces the gentoover patch, it doesn't need reapply every time.
+ sed -i -e 's:^REVISION=.*:REVISION="'${PVR}'":' \
+ -e 's:^BRANCH=.*:BRANCH="Gentoo":' \
+ -e 's:^VERSION=.*:VERSION="${TYPE} ${BRANCH} ${REVISION}":' \
+ "${S}/conf/newvers.sh"
+
+ epatch "${FILESDIR}/${PN}-gentoo.patch"
+ epatch "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch"
+ epatch "${FILESDIR}/${PN}-6.0-asm.patch"
+ epatch "${FILESDIR}/${PN}-6.0-werror.patch"
+ epatch "${FILESDIR}/${PN}-6.2-gcc41.patch"
+ epatch "${FILESDIR}/${PN}-6.2-sparc64.patch"
+ epatch "${FILESDIR}/${PN}-6.1-ntfs.patch"
+ epatch "${FILESDIR}/${PN}-6.2-debug-O2.patch"
+
+ # Errata patches
+ epatch "${FILESDIR}/${P}-EN-07:02.net.patch"
+ epatch "${FILESDIR}/${P}-unp_gc.patch"
+
+ # http://security.freebsd.org/advisories/FreeBSD-SA-07:03.ipv6.asc
+ epatch "${FILESDIR}/${P}-ipv6.patch"
+
+ # Disable SSP for the kernel
+ grep -Zlr -- -ffreestanding "${S}" | xargs -0 sed -i -e \
+ "s:-ffreestanding:-ffreestanding $(test-flags -fno-stack-protector -fno-stack-protector-all):g"
+}
+
+src_compile() {
+ einfo "Nothing to compile.."
+}
+
+src_install() {
+ insinto "/usr/src/sys-${MY_PVR}"
+ doins -r "${S}/"*
+}
+
+pkg_postinst() {
+ if [[ ! -L "${ROOT}/usr/src/sys" ]]; then
+ einfo "/usr/src/sys symlink doesn't exist; creating symlink to sys-${MY_PVR}..."
+ ln -sf "sys-${MY_PVR}" "${ROOT}/usr/src/sys" || \
+ eerror "Couldn't create ${ROOT}/usr/src/sys symlink."
+ # just in case...
+ [[ -L ""${ROOT}/usr/src/sys-${RV}"" ]] && rm "${ROOT}/usr/src/sys-${RV}"
+ ln -sf "sys-${MY_PVR}" "${ROOT}/usr/src/sys-${RV}" || \
+ eerror "Couldn't create ${ROOT}/usr/src/sys-${RV} symlink."
+ elif use symlink; then
+ einfo "Updating /usr/src/sys symlink to sys-${MY_PVR}..."
+ rm "${ROOT}/usr/src/sys" "${ROOT}/usr/src/sys-${RV}" || \
+ eerror "Couldn't remove previous symlinks, please fix manually."
+ ln -sf "sys-${MY_PVR}" "${ROOT}/usr/src/sys" || \
+ eerror "Couldn't create ${ROOT}/usr/src/sys symlink."
+ ln -sf "sys-${MY_PVR}" "${ROOT}/usr/src/sys-${RV}" || \
+ eerror "Couldn't create ${ROOT}/usr/src/sys-${RV} symlink."
+ fi
+
+ if use sparc-fbsd ; then
+ ewarn "WARNING: kldload currently causes kernel panics"
+ ewarn "on sparc64. This is probably a gcc-4.1 issue, but"
+ ewarn "we need gcc-4.1 to compile the kernel correctly :/"
+ ewarn "Please compile all modules you need into the kernel"
+ fi
+}