From owner-svn-src-head@freebsd.org Fri Nov 20 23:57:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36A6DA33F1D; Fri, 20 Nov 2015 23:57:54 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AFEC1E1B; Fri, 20 Nov 2015 23:57:51 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [172.17.133.77] (dip-cali.panasas.com [64.80.217.3]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NY5005YD18BJA10@mr11p00im-asmtp003.me.com>; Fri, 20 Nov 2015 23:57:50 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-11-21_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510090000 definitions=main-1511200418 User-Agent: Microsoft-MacOutlook/0.0.0.151105 Date: Fri, 20 Nov 2015 15:57:44 -0800 Subject: Re: svn commit: r291114 - head/lib/libc/gen From: Ravi Pokala Sender: "Pokala, Ravi" To: Andrey Chernov , Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: "Sanderson, David" Message-id: <28C3C55F-BF25-4DB2-AF05-B57F3F2CCAD5@panasas.com> Thread-topic: svn commit: r291114 - head/lib/libc/gen References: <201511202236.tAKMaf06048447@repo.freebsd.org> <564FAAB0.6000600@freebsd.org> In-reply-to: <564FAAB0.6000600@freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 23:57:54 -0000 -----Original Message----- From: Andrey Chernov Date: 2015-11-20, Friday at 15:20 To: Ravi Pokala , , , Subject: Re: svn commit: r291114 - head/lib/libc/gen >On 21.11.2015 1:36, Ravi Pokala wrote: >> Move fdopen() up near other resource allocation like malloc(); do proper >> deallocation on failure later on in the function. > >Incorrect. Old code calls fdopen() only in the parent, new one calls >fdopen() before fork(), so its results shared by both parent and child, >which is wrong for child() case. There's two different things at play - userland resources and kernel resources. Both "FILE *iop" and "struct pid *cur" are userland, while the descriptors in "pdes" are kernel. We clean up the descriptors in "pdes" in call cases, so we're not leaking kernel resources. You're right that "iop" (and "cur", which you didn't mention) appear to be leaked in the child, in that they're not explicitly cleaned up. But they get wiped away by the _execve(), so it doesn't matter. -Ravi