From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 10 09:47:55 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8FB6106568D for ; Thu, 10 Dec 2009 09:47:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 6A1D58FC1B for ; Thu, 10 Dec 2009 09:47:55 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 1DF9E46B0C; Thu, 10 Dec 2009 04:47:55 -0500 (EST) Date: Thu, 10 Dec 2009 09:47:55 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: xorquewasp@googlemail.com In-Reply-To: Message-ID: References: <20091130142950.GA86528@logik.internal.network> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: UNIX domain sockets on nullfs still broken? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2009 09:47:55 -0000 On Thu, 10 Dec 2009, Robert Watson wrote: > On Mon, 30 Nov 2009, xorquewasp@googlemail.com wrote: > >> jackd (audio/jack) creates a directory in /tmp with a UNIX domain socket in >> it. Clients connect to this socket to communicate with the server. > > We currently support the sharing of UNIX domain sockets between file system > layers on either nullfs or unionfs. In the former case, this is a bug, and Should read "neither ... nor". Robert N M Watson Computer Laboratory University of Cambridge > in the latter case, it is a feature. > > The specific nature of the bug is that you can't just copy the socket pointer > between layers in the vnode stack without additional reference counting (and > other similar state propagation), so if we allowed inter-layer access it > would lead to use-after-free panics and similar sorts of problems. > > This occurs, BTW, because the socket pointer is directly in struct vnode, and > not queried by a VOP, which could be forwarded by nullfs down a layer. The > fixes here aren't easy, so I would anticipate UNIX domain sockets not working > across nullfs layers for some time to come. It's not immediately clear to me > which approach is the best way to fix it, since it likely requires UNIX > domain sockets to learn about stacked file systems in some form, which will > significantly complicate an already complicated relationship. > > Robert N M Watson > Computer Laboratory > University of Cambridge > >> >> $ jackd -d oss -r 44100 -p 128 >> $ ls -alF /tmp/jack-11001/default >> total 4 >> drwx------ 2 xw wheel 512 30 Nov 14:19 ./ >> drwx------ 3 xw wheel 512 30 Nov 14:19 ../ >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-0| >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-1| >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-2| >> srwxr-xr-x 1 xw wheel 0 30 Nov 14:19 jack_0= >> srwxr-xr-x 1 xw wheel 0 30 Nov 14:19 jack_ack_0= >> >> $ sudo mount_nullfs /tmp/ /jail/k4m/tmp >> >> In the jail: >> >> k4m$ ls -alF /tmp/jack-11001/default >> drwx------ 2 xw wheel 512 30 Nov 14:19 ./ >> drwx------ 3 xw wheel 512 30 Nov 14:19 ../ >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-0| >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-1| >> prw-r--r-- 1 xw wheel 0 30 Nov 14:19 jack-ack-fifo-54211-2| >> srwxr-xr-x 1 xw wheel 0 30 Nov 14:19 jack_0= >> srwxr-xr-x 1 xw wheel 0 30 Nov 14:19 jack_ack_0= >> >> k4m$ ktrace jack_showtime >> jack server not running? >> >> k4m$ kdump | grep '/tmp/jack-11001' >> 76030 initial thread STRU struct sockaddr { AF_LOCAL, >> /tmp/jack-11001/default/jack_0 } >> 76030 initial thread NAMI "/tmp/jack-11001/default/jack_0" >> 76030 initial thread RET connect -1 errno 61 Connection refused >> >> $ uname -a >> FreeBSD viper.internal.network 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov >> 21 15:02:08 UTC 2009 >> root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >> >> xw >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >> > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >