Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2015 15:57:44 -0800
From:      Ravi Pokala <rpokala@mac.com>
To:        Andrey Chernov <ache@freebsd.org>, Ravi Pokala <rpokala@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Cc:        "Sanderson, David" <dws@panasas.com>
Subject:   Re: svn commit: r291114 - head/lib/libc/gen
Message-ID:  <28C3C55F-BF25-4DB2-AF05-B57F3F2CCAD5@panasas.com>
In-Reply-To: <564FAAB0.6000600@freebsd.org>
References:  <201511202236.tAKMaf06048447@repo.freebsd.org> <564FAAB0.6000600@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----


From: Andrey Chernov <ache@freebsd.org>
Date: 2015-11-20, Friday at 15:20
To: Ravi Pokala <rpokala@FreeBSD.org>, <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, <svn-src-head@freebsd.org>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28C3C55F-BF25-4DB2-AF05-B57F3F2CCAD5>