From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 14 05:30:10 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BA8A1065672 for ; Thu, 14 Jun 2012 05:30:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 6EA368FC12 for ; Thu, 14 Jun 2012 05:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5E5UAKH097682 for ; Thu, 14 Jun 2012 05:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5E5UAmP097679; Thu, 14 Jun 2012 05:30:10 GMT (envelope-from gnats) Date: Thu, 14 Jun 2012 05:30:10 GMT Message-Id: <201206140530.q5E5UAmP097679@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Jukka A. Ukkonen" Cc: 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 Reply-To: "Jukka A. Ukkonen" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 05:30:10 -0000 The following reply was made to PR bin/80798; it has been noted by GNATS. From: "Jukka A. Ukkonen" To: bug-followup@FreeBSD.org, hohmuth@sax.de Cc: Subject: Re: bin/80798: mount_portal pipe leaves file descriptors open for child processes Date: Thu, 14 Jun 2012 08:28:45 +0300 This is a multi-part message in MIME format. --------------050707020708060501030604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To properly fix the anomaly (not just a workaround) only closing those couple of extra file descriptors at exec() apply the attached patch to stop leaking the socket to /tmp/portalXXXXXXXXX and the patch to the separate PR http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/80798 which plugs the leak of a descriptor to /etc/fstab. --jau --------------050707020708060501030604 Content-Type: text/plain; charset=UTF-8; name="mount_portalfs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mount_portalfs.patch" --- usr.sbin/mount_portalfs/mount_portalfs.c.orig 2012-06-14 07:52:20.000000000 +0300 +++ usr.sbin/mount_portalfs/mount_portalfs.c 2012-06-14 08:07:54.000000000 +0300 @@ -58,6 +58,7 @@ #include #include #include +#include #include "mntopts.h" #include "pathnames.h" @@ -167,6 +168,8 @@ (void) listen(so, 5); + (void) fcntl (so, F_SETFD, FD_CLOEXEC); + args.pa_socket = so; sprintf(tag, "portal:%d", getpid()); args.pa_config = tag; @@ -260,6 +263,9 @@ break; case 0: (void) close(so); + + (void) fcntl (so2, F_SETFD, FD_CLOEXEC); + activate(&q, so2); exit(0); default: --------------050707020708060501030604--