From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62802 invoked by alias); 29 Sep 2018 14:04:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 62787 invoked by uid 89); 29 Sep 2018 14:04:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Sep 2018 14:04:08 +0000 Received: from [10.0.0.136] (modemcable044.137-81-70.mc.videotron.ca [70.81.137.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id DEFB91E186; Sat, 29 Sep 2018 10:04:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1538229847; bh=kEu1c0cLcR6jkjhczAe4zS5kjLtUUx1HM6xeDWDPwMk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=B2ozVizHj5pFIrQUSNN8pKnHaOVxdHeXn3NFpTFDmqlVXKXdOjxcYw/zEql1lzB7B cEZF/Dqy6vItkXsVtLOJeU3b5v48ROaKBu1PYAXql6WzMcIBQ4iaFbxyO1hufvfEhG +4z5QG8NQe9Uo/wvmxVGqnkkTOwepLjR/TjVHzRA= Subject: Re: [RFC 4/6] Use mkostemp, not mkstemp To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20180926111130.18956-1-tom@tromey.com> <20180926111130.18956-5-tom@tromey.com> <2b6097b6-5ffd-6531-4e58-06e1ca62b3d8@simark.ca> <87a7o0ii4h.fsf@tromey.com> From: Simon Marchi Message-ID: <75cd8399-c55e-7551-f755-15ed581b709e@simark.ca> Date: Sat, 29 Sep 2018 14:04:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <87a7o0ii4h.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-09/txt/msg00934.txt.bz2 On 2018-09-29 8:49 a.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> On 2018-09-26 7:11 a.m., Tom Tromey wrote: >>> I noticed that gdb could leak file descriptors coming from mkstemp. >>> This patch fixes the problem by importing the gnulib mkostemp instead, >>> and then changing gdb to pass O_CLOEXEC. > > Simon> While this looks like the correct thing to do, I am curious to know if > Simon> you encountered an actual issue or this is theoretical. I don't see > Simon> how a fork/exec could happen while one of these temp files are open. > > It can happen if there is a Python or Guile thread that fork+execs. > It seems like it would be hard to observe, but on the other hand, fixing > it seems pretty easy. Ah I see, I was only thinking about the exec when you use "run". Thanks! Simon