public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@codesourcery.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH] libgomp: fix hang on fatal error
Date: Fri, 14 Oct 2022 18:04:06 +0100	[thread overview]
Message-ID: <c72ceaca-53e4-3deb-c0a6-57af9b2935a4@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

This patch fixes a problem in which fatal errors inside mutex-locked 
regions (i.e. basically anything in the plugin) will cause it to hang up 
trying to take the lock to clean everything up.

Using abort() instead of exit(1) bypasses the atexit handlers and solves 
the problem.

OK for mainline?

Andrew

[-- Attachment #2: 221014-abort-libgomp.patch --]
[-- Type: text/plain, Size: 512 bytes --]

libgomp: fix hang on fatal error

Don't try to clean up if a fatal error occurs in libgomp.  Typically the
cleanup is not reentrant so we end up hung on a lock.

libgomp/ChangeLog:

	* error.c (gomp_vfatal): Use abort instead of exit.

diff --git a/libgomp/error.c b/libgomp/error.c
index 50ed85eedb1..25548c14a82 100644
--- a/libgomp/error.c
+++ b/libgomp/error.c
@@ -77,7 +77,7 @@ void
 gomp_vfatal (const char *fmt, va_list list)
 {
   gomp_verror (fmt, list);
-  exit (EXIT_FAILURE);
+  abort ();
 }
 
 void

             reply	other threads:[~2022-10-14 17:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 17:04 Andrew Stubbs [this message]
2022-10-19 13:27 ` Jakub Jelinek
2022-10-19 16:08   ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c72ceaca-53e4-3deb-c0a6-57af9b2935a4@codesourcery.com \
    --to=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).