unix domain sockets on nullfs(5)

Kostik Belousov kostikbel at gmail.com
Thu Jan 12 21:51:11 UTC 2012


On Thu, Jan 12, 2012 at 09:39:53PM +0000, Robert N. M. Watson wrote:
> 
> On 12 Jan 2012, at 21:17, Mikolaj Golub wrote:
> 
> > If we agree to have only the new behavior then nullfs won't need modification
> > at all, it will work as expected automatically. The patch could be (with updated
> > locking for the connect case):
> > 
> > http://people.freebsd.org/~trociny/VOP_UNP.1.patch
> 
> Greatly simplified.
> 
> > --- sys/kern/uipc_usrreq.c	(revision 229979)
> > +++ sys/kern/uipc_usrreq.c	(working copy)
> > @@ -542,7 +542,7 @@
> >  
> >  	UNP_LINK_WLOCK();
> >  	UNP_PCB_LOCK(unp);
> > -	vp->v_socket = unp->unp_socket;
> > +	VOP_UNPBIND(vp, unp->unp_socket);
> >  	unp->unp_vnode = vp;
> >  	unp->unp_addr = soun;
> >  	unp->unp_flags &= ~UNP_BINDING;
> 
> 
> I still find myself worried by the fact that unp->unp_vnode points at the nullfs vnode rather than the underlying vnode, but haven't yet managed to identify any actual bugs that would result. I'll continue pondering it over the weekend :-).

I think I know what could go wrong there, but due to other bug, this
wrongness cannot be realized now.

Issue is that for the forced unmount, the unp_vnode is reclaimed, so that
the unix domain sockets code references freed memory after reclaim.

Probably, some helper should provided by uipc_usrreq, called from VOP_RECLAIM()
implementations for VSOCK types of vnodes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20120112/56e91d4d/attachment.pgp


More information about the freebsd-arch mailing list