From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12465 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] re-fix child reaping in wordexp Date: Mon, 5 Feb 2018 15:44:32 -0500 Message-ID: <20180205204432.GA1627@brightrain.aerifal.cx> References: <20180205143837.26009-1-amonakov@ispras.ru> <20180205162715.GW1627@brightrain.aerifal.cx> <20180205172714.GY1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1517863376 20996 195.159.176.226 (5 Feb 2018 20:42:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Feb 2018 20:42:56 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12481-gllmg-musl=m.gmane.org@lists.openwall.com Mon Feb 05 21:42:52 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1einb9-0004cT-LU for gllmg-musl@m.gmane.org; Mon, 05 Feb 2018 21:42:43 +0100 Original-Received: (qmail 19561 invoked by uid 550); 5 Feb 2018 20:44:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19537 invoked from network); 5 Feb 2018 20:44:45 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12465 Archived-At: On Mon, Feb 05, 2018 at 11:18:45PM +0300, Alexander Monakov wrote: > On Mon, 5 Feb 2018, Rich Felker wrote: > > OK, that makes sense -- it's a matter of tiny window vs > > unboundedly-large window. And in this case EINTR is not relevant; the > > same unboundedly-large window can happen if you have a long-running > > signal handler with SA_RESTART. > > Hm, not sure I follow - can you elaborate? What is the timeline of events > leading to an issue? 1. waitpid starts waiting for pid 42 2. signal arrives and handler begins running 3. pid 42 exits, gets reaped, and a new child with pid 42 appears 4. signal handler returns 5. waitpid resumes waiting for pid 42 For step 3, think of the signal handler as handling SIGCHLD, reaping the child, and then doing some operation that might block, and the new child with pid 42 getting created concurrently from another thread. Rich