summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2006-09-04 18:49:15 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2006-09-04 18:49:15 +0000
commit9494aa617df7721e576f5be30e5abfe8e07b1d5a (patch)
tree884bfa11167b2fef99db137d551203aac82d46ba /sys-freebsd/freebsd-sources
parentAdd ~x86-fbsd keyword. (diff)
downloadgentoo-2-9494aa617df7721e576f5be30e5abfe8e07b1d5a.tar.gz
gentoo-2-9494aa617df7721e576f5be30e5abfe8e07b1d5a.tar.bz2
gentoo-2-9494aa617df7721e576f5be30e5abfe8e07b1d5a.zip
Add patch from Alex for sandbox not to deadlock devfs, see bug #146284.
(Portage version: 2.1.1_rc1-r3)
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.1-r43
-rw-r--r--sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-devfs-deadlock.patch165
-rw-r--r--sys-freebsd/freebsd-sources/freebsd-sources-6.1-r4.ebuild80
4 files changed, 256 insertions, 1 deletions
diff --git a/sys-freebsd/freebsd-sources/ChangeLog b/sys-freebsd/freebsd-sources/ChangeLog
index 1cc40ebf4718..988ce1c181b9 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-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sources/ChangeLog,v 1.18 2006/07/27 01:43:51 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sources/ChangeLog,v 1.19 2006/09/04 18:49:15 flameeyes Exp $
+
+*freebsd-sources-6.1-r4 (04 Sep 2006)
+
+ 04 Sep 2006; Diego Pettenò <flameeyes@gentoo.org>
+ +files/freebsd-sources-6.1-devfs-deadlock.patch,
+ +freebsd-sources-6.1-r4.ebuild:
+ Add patch from Alex for sandbox not to deadlock devfs, see bug #146284.
27 Jul 2006; Diego Pettenò <flameeyes@gentoo.org>
-files/SA-06-04-ipfw.patch, -files/SA-06-06-kmem60.patch,
diff --git a/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.1-r4 b/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.1-r4
new file mode 100644
index 000000000000..ed81a3f45c74
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/digest-freebsd-sources-6.1-r4
@@ -0,0 +1,3 @@
+MD5 8893a0a0ddfa8959f71e8ee561a11333 freebsd-sys-6.1.tar.bz2 17361671
+RMD160 eb19f6a345c665542df694a4f9170d227beaf3b6 freebsd-sys-6.1.tar.bz2 17361671
+SHA256 d2ecd79b83ba06c12e358adfccc7e057e15fb7c5be76d92c537b99cbe1d84f0f freebsd-sys-6.1.tar.bz2 17361671
diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-devfs-deadlock.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-devfs-deadlock.patch
new file mode 100644
index 000000000000..016bdb9d1f19
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-devfs-deadlock.patch
@@ -0,0 +1,165 @@
+diff -Naur devfs/devfs.h devfsb/devfs.h
+--- fs/devfs/devfs.h 2006-08-18 17:23:00 +0000
++++ fs/devfsb/devfs.h 2006-09-03 19:34:57 +0000
+@@ -163,7 +163,7 @@
+ void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de);
+ void devfs_rules_cleanup (struct devfs_mount *dm);
+ int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td);
+-int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td);
++int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, int *dm_unlock, struct thread *td);
+ struct cdev **devfs_itod (int inode);
+ struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode);
+ void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de);
+diff -Naur devfs/devfs_vfsops.c devfsb/devfs_vfsops.c
+--- fs/devfs/devfs_vfsops.c 2006-08-18 17:23:00 +0000
++++ fs/devfsb/devfs_vfsops.c 2006-09-03 19:34:57 +0000
+@@ -139,9 +139,11 @@
+ int error;
+ struct vnode *vp;
+ struct devfs_mount *dmp;
++ int dm_unlock;
+
+ dmp = VFSTODEVFS(mp);
+- error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td);
++ dm_unlock = 0;
++ error = devfs_allocv(dmp->dm_rootdir, mp, &vp, &dm_unlock, td);
+ if (error)
+ return (error);
+ vp->v_vflag |= VV_ROOT;
+diff -Naur devfs/devfs_vnops.c devfsb/devfs_vnops.c
+--- fs/devfs/devfs_vnops.c 2006-08-18 17:23:00 +0000
++++ fs/devfsb/devfs_vnops.c 2006-09-03 19:34:57 +0000
+@@ -124,16 +124,23 @@
+ }
+
+ int
+-devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td)
++devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp,
++ int *dm_unlock, struct thread *td)
+ {
+ int error;
+ struct vnode *vp;
+ struct cdev *dev;
++ struct devfs_mount *dmp;
+
+ KASSERT(td == curthread, ("devfs_allocv: td != curthread"));
++ dmp = VFSTODEVFS(mp);
+ loop:
+ vp = de->de_vnode;
+ if (vp != NULL) {
++ if (*dm_unlock) {
++ sx_xunlock(&dmp->dm_lock);
++ *dm_unlock = 0;
++ }
+ if (vget(vp, LK_EXCLUSIVE, td))
+ goto loop;
+ *vpp = vp;
+@@ -173,6 +180,10 @@
+ }
+ vp->v_data = de;
+ de->de_vnode = vp;
++ if (*dm_unlock) {
++ sx_xunlock(&dmp->dm_lock);
++ *dm_unlock = 0;
++ }
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ #ifdef MAC
+ mac_associate_vnode_devfs(mp, de, vp);
+@@ -453,7 +464,7 @@
+ }
+
+ static int
+-devfs_lookupx(struct vop_lookup_args *ap)
++devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
+ {
+ struct componentname *cnp;
+ struct vnode *dvp, **vpp;
+@@ -504,7 +515,7 @@
+ de = TAILQ_FIRST(&dd->de_dlist); /* "." */
+ de = TAILQ_NEXT(de, de_list); /* ".." */
+ de = de->de_dir;
+- error = devfs_allocv(de, dvp->v_mount, vpp, td);
++ error = devfs_allocv(de, dvp->v_mount, vpp, dm_unlock, td);
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
+ return (error);
+ }
+@@ -561,7 +572,7 @@
+ return (0);
+ }
+ }
+- error = devfs_allocv(de, dvp->v_mount, vpp, td);
++ error = devfs_allocv(de, dvp->v_mount, vpp, dm_unlock, td);
+ return (error);
+ }
+
+@@ -570,11 +581,14 @@
+ {
+ int j;
+ struct devfs_mount *dmp;
++ int dm_unlock;
+
+ dmp = VFSTODEVFS(ap->a_dvp->v_mount);
++ dm_unlock = 1;
+ sx_xlock(&dmp->dm_lock);
+- j = devfs_lookupx(ap);
+- sx_xunlock(&dmp->dm_lock);
++ j = devfs_lookupx(ap, &dm_unlock);
++ if (dm_unlock == 1)
++ sx_xunlock(&dmp->dm_lock);
+ return (j);
+ }
+
+@@ -586,6 +600,7 @@
+ struct thread *td;
+ struct devfs_dirent *dd, *de;
+ struct devfs_mount *dmp;
++ int dm_unlock;
+ int error;
+
+ /*
+@@ -597,6 +612,7 @@
+ dvp = ap->a_dvp;
+ dmp = VFSTODEVFS(dvp->v_mount);
+ sx_xlock(&dmp->dm_lock);
++ dm_unlock = 1;
+
+ cnp = ap->a_cnp;
+ vpp = ap->a_vpp;
+@@ -617,9 +633,10 @@
+ if (de == NULL)
+ goto notfound;
+ de->de_flags &= ~DE_WHITEOUT;
+- error = devfs_allocv(de, dvp->v_mount, vpp, td);
++ error = devfs_allocv(de, dvp->v_mount, vpp, &dm_unlock, td);
+ notfound:
+- sx_xunlock(&dmp->dm_lock);
++ if (dm_unlock == 1)
++ sx_xunlock(&dmp->dm_lock);
+ return (error);
+ }
+
+@@ -1101,6 +1118,7 @@
+ struct devfs_dirent *de;
+ struct devfs_mount *dmp;
+ struct thread *td;
++ int dm_unlock;
+
+ td = ap->a_cnp->cn_thread;
+ KASSERT(td == curthread, ("devfs_symlink: td != curthread"));
+@@ -1119,12 +1137,14 @@
+ de->de_symlink = malloc(i, M_DEVFS, M_WAITOK);
+ bcopy(ap->a_target, de->de_symlink, i);
+ sx_xlock(&dmp->dm_lock);
++ dm_unlock = 1;
+ #ifdef MAC
+ mac_create_devfs_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de);
+ #endif
+ TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list);
+- devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, td);
+- sx_xunlock(&dmp->dm_lock);
++ devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, &dm_unlock, td);
++ if (dm_unlock == 1)
++ sx_xunlock(&dmp->dm_lock);
+ return (0);
+ }
+
diff --git a/sys-freebsd/freebsd-sources/freebsd-sources-6.1-r4.ebuild b/sys-freebsd/freebsd-sources/freebsd-sources-6.1-r4.ebuild
new file mode 100644
index 000000000000..541822fca1be
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/freebsd-sources-6.1-r4.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2006 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.1-r4.ebuild,v 1.1 2006/09/04 18:49:15 flameeyes Exp $
+
+inherit bsdmk freebsd flag-o-matic
+
+DESCRIPTION="FreeBSD kernel sources"
+SLOT="${PVR}"
+KEYWORDS="~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.1-gcc41.patch"
+ epatch "${FILESDIR}/${PN}-6.1-intrcnt.patch"
+
+ # This is to be able to use sandbox safely, see bug #146284
+ epatch "${FILESDIR}/${P}-devfs-deadlock.patch"
+
+ epatch "${FILESDIR}/SA-06-16-smbfs.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
+}