From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 409623858413; Fri, 6 May 2022 18:47:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 409623858413 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: sigproc: Avoid segfault caused by signal just after fork(). X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 7da8066ae8f80da4859201674bc3bfff0e0fe9a2 X-Git-Newrev: 5c7d81b75ea8dae64afb56e38c49063d5776fab9 Message-Id: <20220506184724.409623858413@sourceware.org> Date: Fri, 6 May 2022 18:47:24 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 18:47:24 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5c7d81b75ea= 8dae64afb56e38c49063d5776fab9 commit 5c7d81b75ea8dae64afb56e38c49063d5776fab9 Author: Takashi Yano Date: Thu May 5 21:12:26 2022 +0900 Cygwin: sigproc: Avoid segfault caused by signal just after fork(). =20 - The commit "Cygwin: always add sigmask to child info" also tries to fix this issue, however, did not fix enough. This patch fixes that. Diff: --- winsup/cygwin/sigproc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index b5143e853..fbb1f0ef4 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1376,9 +1376,9 @@ wait_sig (VOID *) when _main_tls points to the system-allocated stack, not to the parent thread. In that case find_tls fails, and we fetch the sigmask from the child_info passed from the parent. */ - tl_entry =3D cygheap->find_tls (_main_tls); - if (tl_entry) + if (cygwin_finished_initializing) { + tl_entry =3D cygheap->find_tls (_main_tls); dummy_mask =3D _main_tls->sigmask; cygheap->unlock_tls (tl_entry); }