From: Mark Wielaard <mark@klomp.org>
To: bzip2-devel@sourceware.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: Re: [PATCH] Don't call unsafe functions from SIGSEGV/SIGBUS signal handler.
Date: Sat, 23 May 2020 18:35:36 +0200 [thread overview]
Message-ID: <f3da210edb01a9b226e9c4122218a7728adb7078.camel@klomp.org> (raw)
In-Reply-To: <20200517190939.29003-1-mark@klomp.org>
Hi,
On Sun, 2020-05-17 at 21:09 +0200, Mark Wielaard wrote:
> GCC10 -fanalyzer notices that we try to call functions that are not
> signal safe from our fatal signal handler:
>
> bzip2.c: In function ‘mySIGSEGVorSIGBUScatcher’:
> bzip2.c:819:7: warning: call to ‘fprintf’ from within signal handler
> [CWE-479] [-Wanalyzer-unsafe-call-within-signal-
> handler]
>
> It also notices we then call showFileNames and cleanupAndFail which
> also call possibly not signal safe functions.
>
> Just write out the error message directly to STDERR and exit without
> trying to clean up any files.
I pushed this to master now.
Note GCC11 will also warn about the previous usage of exit() (which is
also not signal safe and was replaced with _exit() in this patch):
https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546189.html
Cheers,
Mark
prev parent reply other threads:[~2020-05-23 16:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-17 19:09 Mark Wielaard
2020-05-23 16:35 ` Mark Wielaard [this message]
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=f3da210edb01a9b226e9c4122218a7728adb7078.camel@klomp.org \
--to=mark@klomp.org \
--cc=bzip2-devel@sourceware.org \
--cc=dmalcolm@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).