Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2012 11:18:42 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        "Jukka A. Ukkonen" <jau@oxit.fi>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/80798: mount_portal pipe leaves file descriptors open for child processes
Message-ID:  <20120609091841.GA21543@dft-labs.eu>
In-Reply-To: <201206090850.q598o6iw006147@freefall.freebsd.org>
References:  <201206090850.q598o6iw006147@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 09, 2012 at 08:50:06AM +0000, Jukka A. Ukkonen wrote:
>  It seems that item 2 is not a real issue, because the unused
>  stdin is bound to /dev/null exactly as it should be to avoid
>  stdin being accidentally bound to some file while the child
>  program is running.
>  The same /dev/null treatment works also for stdout to avoid
>  accidentally writing to an unexpected file.
>  The stderr is directed to a pipe which in turn gets forwarded
>  to the syslogd.
>  
>  While the item 1 has been an anomaly it has not been a big
>  issue. The only extra fds left for the child program have been
>  a read-only descriptor to /etc/fstab and a writable pipe to
>  feed syslogd.
>  It seems lsof opens its own new file descriptor under /tmp.
>  So, that one does not really count as an anomalous fd.
>  
>  To be really pedantic about the fds to fstab and syslogd
>  apply the attached patch to close everything in the range
>  3...(getdtablesize()-1).
>  Notice, though, that the range may be very large. (Ref.
>  the resource limits.)
>  

Take a look at closefrom(2).

portalfs is rather buggy and not mpsafe (at least not marked as such).
The latter makes it scheduled for removal - see:
http://wiki.freebsd.org/NONMPSAFE_DEORBIT_VFS

With that being said, if you really need portalfs, I would go with
reimplementation from scratch using fuse (perhaps available already).

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120609091841.GA21543>