From owner-freebsd-stable@FreeBSD.ORG Tue Mar 14 13:17:56 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E274716A420; Tue, 14 Mar 2006 13:17:55 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9EEF743D45; Tue, 14 Mar 2006 13:17:55 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from localhost.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k2EDHrWv073328; Tue, 14 Mar 2006 13:17:55 GMT (envelope-from davidxu@freebsd.org) From: David Xu To: freebsd-stable@freebsd.org Date: Tue, 14 Mar 2006 21:17:49 +0800 User-Agent: KMail/1.8.2 References: <200603111140.k2BBerFh096411@freefall.freebsd.org> <20060314120153.GL37572@deviant.kiev.zoral.com.ua> <20060314130242.GN37572@deviant.kiev.zoral.com.ua> In-Reply-To: <20060314130242.GN37572@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603142117.49739.davidxu@freebsd.org> Cc: Kostik Belousov , bug-followup@freebsd.org, Martin Subject: Re: [patch] Re: kern/94278: Crash with FIFOs and ktrace X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2006 13:17:56 -0000 On Tuesday 14 March 2006 21:02, Kostik Belousov wrote: > Sorry for garbled patch. I do not know why mutt decided to encode > some "=" as =3D. > > > Index: compat/linux/linux_misc.c > =================================================================== > RCS file: /usr/local/arch/ncvs/src/sys/compat/linux/linux_misc.c,v > retrieving revision 1.172 > diff -u -r1.172 linux_misc.c > --- compat/linux/linux_misc.c 28 Dec 2005 07:08:54 -0000 1.172 > +++ compat/linux/linux_misc.c 14 Mar 2006 11:45:57 -0000 > @@ -310,6 +310,21 @@ > * XXX: This should use vn_open() so that it is properly authorized, > * and to reduce code redundancy all over the place here. > */ > + if (vp->v_type == VLNK) { > + error = EMLINK; > + goto cleanup; > + } > + if (vp->v_type == VSOCK) { > + error = EOPNOTSUPP; > + goto cleanup; > + } > + if (vp->v_type == VFIFO) { > + /* Due to way fifo works (by overloading f_ops), > + * tricking kernel into write to the fifo leads to > + * panic. Make a band-aid to filter the case. */ > + error = EOPNOTSUPP; > + goto cleanup; > + } > #ifdef MAC > error = mac_check_vnode_open(td->td_ucred, vp, FREAD); > if (error) > Index: fs/fifofs/fifo_vnops.c > =================================================================== > RCS file: /usr/local/arch/ncvs/src/sys/fs/fifofs/fifo_vnops.c,v > retrieving revision 1.132 > diff -u -r1.132 fifo_vnops.c > --- fs/fifofs/fifo_vnops.c 1 Oct 2005 20:15:41 -0000 1.132 > +++ fs/fifofs/fifo_vnops.c 14 Mar 2006 11:46:07 -0000 > @@ -168,6 +168,7 @@ > int a_mode; > struct ucred *a_cred; > struct thread *a_td; > + int a_fdidx; > } */ *ap; > { > struct vnode *vp = ap->a_vp; > Index: kern/vfs_syscalls.c > =================================================================== > RCS file: /usr/local/arch/ncvs/src/sys/kern/vfs_syscalls.c,v > retrieving revision 1.411 > diff -u -r1.411 vfs_syscalls.c > --- kern/vfs_syscalls.c 4 Mar 2006 00:09:09 -0000 1.411 > +++ kern/vfs_syscalls.c 14 Mar 2006 11:46:10 -0000 > @@ -4101,6 +4101,13 @@ > error = EOPNOTSUPP; > goto bad; > } > + if (vp->v_type == VFIFO) { > + /* Due to way fifo works (by overloading f_ops), > + * tricking kernel into write to the fifo leads to > + * panic. Make a band-aid to filter the case. */ > + error = EOPNOTSUPP; > + goto bad; > + } > mode = 0; > if (fmode & (FWRITE | O_TRUNC)) { > if (vp->v_type == VDIR) { > Index: kern/vfs_vnops.c > =================================================================== > RCS file: /usr/local/arch/ncvs/src/sys/kern/vfs_vnops.c,v > retrieving revision 1.238 > diff -u -r1.238 vfs_vnops.c > --- kern/vfs_vnops.c 11 Mar 2006 17:14:05 -0000 1.238 > +++ kern/vfs_vnops.c 14 Mar 2006 11:46:10 -0000 > @@ -194,6 +194,13 @@ > error = EOPNOTSUPP; > goto bad; > } > + if ((vp->v_type == VFIFO) && (fdidx < 0)) { > + /* Due to way fifo works (by overloading f_ops), > + * tricking kernel into write to the fifo leads to > + * panic. Make a band-aid to filter the case. */ > + error = EOPNOTSUPP; > + goto bad; > + } > mode = 0; > if (fmode & (FWRITE | O_TRUNC)) { > if (vp->v_type == VDIR) { > I know, someone will work out such a messy patch, but is it reasonable ? why does not the fifi code suddenly work with well defined vnode interface ? why did someone want to break the well defined FILE->vnode->fs->device layers ? sigh. David Xu