bin/80798: mount_portal pipe leaves file descriptors open for
child processes
Mateusz Guzik
mjguzik at gmail.com
Sat Jun 9 09:18:51 UTC 2012
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>
More information about the freebsd-bugs
mailing list