[913] in linux-net channel archive

home help back first fref pref prev next nref lref last post

File descriptor passing

daemon@ATHENA.MIT.EDU (Alan Cox)
Wed Aug 16 22:14:03 1995

Date: Wed, 16 Aug 95 10:28 BST
From: iialan@iifeak.swan.ac.uk (Alan Cox)
To: linux-net@vger.rutgers.edu


I've been putting this bit in but come across an interesting and highly amusing
problem that also appears to afflict BSD based systems.

	Create and bind a pair of AF_UNIX datagram sockets.
	Send the file descriptor of each socket to the other one
	Do not read these descriptors!
	close both sockets and unlink the names

Now both sockets are open because of the file descriptor in the other one and
you can't get it back. This degenerates to the generic lisp garbage collection
problem. Unfortunately you can of course hide a descriptor on every filesystem
in there too before closing so that you cant umount any filesystems.

Alan

home help back first fref pref prev next nref lref last post