From owner-freebsd-bugs@FreeBSD.ORG Sat Jun 9 09:18:51 2012 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01061106566C for ; Sat, 9 Jun 2012 09:18:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 846168FC08 for ; Sat, 9 Jun 2012 09:18:50 +0000 (UTC) Received: by eeke49 with SMTP id e49so1642396eek.13 for ; Sat, 09 Jun 2012 02:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=VPst9AgWya6LwfPh5vGcVPmdso4VDsgEOnAKRxFRbf8=; b=HP6XV7nIBX9jARltn2GZcd2bt/UAqeJKNsvymsvGkYM2lmc3RfowhpqC6EmZBb9wyY jEa/sj57S+mNUzDWYJgr2bqRil8j7abUe61CxmeS63NVkQ1dro4LhOb+/TW3aCWgV44+ IjMKPpH+IrwrWaKlE2DJoRdIbrk389+Qf7RTS1BrYVTJpagPEGNx5Tuqy6fJOhXEV0lM Bdgv22Sh1wcEJ7WONglAf6abko4dAzJ7fkBQCxp4LaWWaK5fYvfolxeW+fty/K0yaFVR zeYXiz1orYvb0TsK0G8eGxnXu4gyIelWhbbbGENWzSHpamvJVfY665FcemXyJUTFeQu2 /9Yw== Received: by 10.14.96.73 with SMTP id q49mr4522119eef.76.1339233529361; Sat, 09 Jun 2012 02:18:49 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id c13sm30750366eeb.7.2012.06.09.02.18.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 09 Jun 2012 02:18:48 -0700 (PDT) Date: Sat, 9 Jun 2012 11:18:42 +0200 From: Mateusz Guzik To: "Jukka A. Ukkonen" Message-ID: <20120609091841.GA21543@dft-labs.eu> References: <201206090850.q598o6iw006147@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201206090850.q598o6iw006147@freefall.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/80798: mount_portal pipe leaves file descriptors open for child processes X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 09:18:51 -0000 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